Hello!
this group has been helpful to me in the past, and I’ve got another problem that I am stuck on :O) The issue has to do with reflection maps on my models in OpenGL. Currently, I am applying the reflection maps with multipass, like this:
// pass 1: draw reflection map
glActiveTextureARB(GL_TEXTURE0_ARB);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, reflection_map);
glBlendFunc(GL_ONE, GL_ZERO);
glBegin();
… draw triangles
glEnd();
// pass 2: draw base texture map which has 1-bit alpha (format is 1555)
glActiveTextureARB(GL_TEXTURE1_ARB);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, base_map);
glBlendFunc(GL_ONE, GL_SRC_ALPHA);
glBegin();
… draw triangles
glEnd();
This way, I use the alpha in the base map to ensure that the reflection map is only applied to the parts that I want (where the alpha is on). However, when I try to do this w/ multitexturing in a single pass, the result is not what I expect; I set it up like so:
glActiveTextureARB(GL_TEXTURE0_ARB);
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, reflection_map);
glBlendFunc(GL_ONE, GL_ZERO);
glActiveTextureARB(GL_TEXTURE1_ARB);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, base_map);
glBlendFunc(GL_ONE, GL_SRC_ALPHA);
glBegin();
… draw triangles (w/ 2 sets of uv coords, everything as it should be in here)
glEnd();
What I get from this is that the base texture is not getting drawn at all in the areas where its alpha is one on the base map, and where it is zero, I see the reflection map blended with the frame buffer color. Any ideas what is up with that? I have tried numerous other combinations of blend-functions, to no avail. I am using a gForce2 under Win2K, so I know the card supports multitexture. Any thoughts are appreciated! Hopefully once I am no longer a newbie to OpenGL (I come from D3D-land), I can be of some help to others myself here )