At this point, GL_TEXTURE1_ARB is still activated, but I guess you may want to activate GL_TEXTURE0_ARB so that next texture calls will affect the texture unit 0.
For instance, let''s append the following lines of code :
glBindTexture(GL_TEXTURE_2D, quadric_texture);
render_the_quadric();
The resulting code is :
glActiveTextureARB(GL_TEXTURE0_ARB);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, m_texture[0]);glActiveTextureARB(GL_TEXTURE1_ARB);glEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, m_texture[1]);glBegin(GL_TRIANGLES);glNormal3f( 0.0f, 0.0f, 1.0f);glColor3f(m_red1,m_green1,m_blue1);glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.5f, 1.0f);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.5f, 1.0f);glVertex3f( 0.0f, m_height, 0.0f);// TopglColor3f(m_red2,m_green2,m_blue2);glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.0f, 0.0f);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0f, 0.0f);glVertex3f(-m_width,-m_height, 0.0f);// Bottom LeftglColor3f(m_red3,m_green3,m_blue3);glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 1.0f, 0.0f);glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0f, 0.0f);glVertex3f( m_width,-m_height, 0.0f);// Bottom RightglEnd();glPopMatrix();glDisable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, quadric_texture);render_the_quadric();
Do you think that those two last lines bind the texture ''quadric_texture'' to texture unit 0 ? false ! It binds it to texture unit 1 because it is the last texture that was activated (note: don''t mistake "activating" a texture unit and "enabling" a texture unit). In other words, you have to call glActiveTextureARB(GL_TEXTURE0_ARB) after rendering a multitextured object, otherwise you don''t know if the following objects will be rendered using the right texture unit.