• Advertisement
Sign in to follow this  

glActiveTextureARB spits everywhere on the scene !!!

This topic is 4581 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I combined multitexturing and sphere mapping to apply on specified objects an environment reflect beside the object’s texture or/and colours. After all the initiation worked out is tried to use the calls like this glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glActiveTextureARB(GL_TEXTURE0_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture[0]); glActiveTextureARB(GL_TEXTURE1_ARB); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture[2]); gluSphere(balle, rayonBalle, 64, 64); glDisable(GL_TEXTURE1_ARB); glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE0_ARB); glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_S); Trying to concentrate the multitexturing only one or more object appeared to be impossible, the actived TEXTURE0_ARB TEXTURE1_ARB won’t deactivate… May someone tell me if I forgot something or what I’m doing wrong…!

Share this post


Link to post
Share on other sites
Advertisement
glActiveTextureARB(GL_TEXTUREx_ARB) is just a unit selector, it won't enable or disable something by itself. It merely selects the unit on which subsequent state changing commands (glEnable, glDisable, etc) are carried out.

So, first you need to realize that GL_TEXTURE_GEN modes are also affected by the active texture unit, since they're part of the texture state and independent for each unit. Then, you need to call glDisable(GL_TEXTURE_2D) for each unit you would like to disable.

Something like this:

// Enable texture mapping units 0 and 1, plus texgen on unit 0
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[2]);

// Render stuff
gluSphere(balle, rayonBalle, 64, 64);

// Disable texture mapping on both units, and texgen on unit 0
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_S);

Share this post


Link to post
Share on other sites
All right, thanks
Used the right way as you showed me, the multitex works like more educated (does not spits everywhere on the street anymore ;-))
Even if because of my blended sphere I presume, my reflection try doesn’t look like one…

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement