PDA

View Full Version : glDisable(GL_TEXTURE_2D) has no effect when using multiTexture ext's



Boris008
01-21-2002, 02:21 PM
I've just started using the multiTexture extension with an nVidia GeForce2 card. I am having trouble disabling textures after applying textures using the multiTexture extensions (at least I think that is the problem). here's an example:

after applying a texture and a light map to a polygon with multiTexture ext's I try the following......

glDisable(GL_TEXTURE_2D);
glColor3f(0.0, 0.0, 1.0);
glutSolidSphere(2, 8, 8); //blue sphere at origin without texture!

.....The sphere does not display as blue!

now, when I'm not using multitexture support I can do multi pass rendering for lightmaps and the above snippet works perfectly. I have included a display list of the multitexture code below.

Note: This problem occurs with or without lighting and material colors enabled!
Does glDiable(GL_TEXTURE_2D) effect the multiTexture "states"?

//========== Dispaly list code snippet ============//
bindedlist = glGenLists(1);

glNewList(bindedlist, GL_COMPILE);
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, demoTexture.m_texture[1]);
glTexEnvf (GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_REPLACE);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, demoTexture.m_texture[0]);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,GL_REPEAT );
glBegin(GL_QUADS);
for(int i=0; i<=5; i++)
{
for(int j=0; j<=3; j++)
{ glMultiTexCoord2fARB(GL_TEXTURE0_ARB, room[i].mLightMap_s[j], room[i].mLightMap_t[j]);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, room[i].mTexCoord_s[j], room[i].mTexCoord_t[j]);
glVertex3f(room[i].mV[j].x, room[i].mV[j].y, room[i].mV[j].z);
}
}
glEnd();
glEndList();
//===========================================//

Thanks,

Jeff

DFrey
01-21-2002, 02:26 PM
You need to disable texturing for each texture environment to completely disable texturing.

Lev
01-21-2002, 02:27 PM
You must disable texturing per unit:

glActiveTexture(GL_TEXTURE0);
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);

-Lev

Boris008
01-21-2002, 02:37 PM
That was too easy, thanks!

Jeff