So, I've got a terrain engine which uses 3 textures, a repeating
surface texture, repeating detail texture, and a 1-to-1 color/shadow
map texture. It works nicely and looks good.
I want to add to it a fourth repeating texture which is applied
selectively based on some function, say, one minus the z-component of
the surface normal or the vertex height. It would be, for example, a
rocky texture applied on hillsides but not on flat surfaces. Pretty
ordinary stuff.
My plan, as it stands, is to use the alpha channel of the color map as
the filter against which to apply the fourth texture. This way I could
use four textures only.
Of course, I know that not a lot of cards support 4 texture units and
I'll implement a fallback for the GF4MX and so on. But for cards that
support it, I'd like to do it.
Anyway, I wrote a simple GLUT app which draws a single textured quad
and lets me fool around and try to get this working.
The testbed app fills the quad with a repeating "O" texture across it
and applies a repeating "X" texture where the alpha channel of the
colormap is non-zero, using GL_INTERPOLATE. This much works GREAT.
It's applying the colormap that's throwing me for a loop. And I think
it comes down to me simply not grokking the texture_env_combine
functionality, though I've read the SGI doc and several resources on
the web.
My colormap/mixmap is as such
RGB: a gaudy swirly set of colors for easy examination
ALPHA: black, fading circularly to white in the center
/*
Set up mixmap blending, use alpha channel of TEXTURE2
as interpolative factor between TEXTURE0 and TEXTURE1
*/
glActiveTextureARB( GL_TEXTURE2_ARB );
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
And here's a link to the output. On the left side is the display
without the colormap applied. On the right is the display *with* the
colormap applied. For some reason, the colormap works correctly where
the colormap's alpha is non-zero, but it fades to black where the
colormap's alpha goes to zero.
I have to assume I'm doing something boneheaded. But please, don't just
point me to the COMBINE documentation. I've read it a dozen times. I
just don't *get* it, I guess. Could somebody clear it up for me? I'm so
baffled, and heartbroken.
Shamyl Zakariya
"this is, after all, one of those movies where people spend a great
deal of time looking at things and pointing."
From a review of _Fantastic Voyage_
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden