• Advertisement

Archived

This topic is now archived and is closed to further replies.

Disabling Multi-texturing

This topic is 5675 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

Is there a way to disable multi-texturing when rendering certain objects? I got multi-texturing to work but now it seems like if only want 1 texture as apposed to more than 1 for certain objects it doesn''t work right.

Share this post


Link to post
Share on other sites
Advertisement
Use glDisable with GL_TEXTURE_2D with each of the non-zero texture units that are currently enabled, then reselect texture unit 0. You may have to do this with texture coordinate arrays too, depending on if you''re using them. Is that what you''ve tried already? If not, what have you tried and what are the results?

Share this post


Link to post
Share on other sites
Did you mean something like this?



  
if (!multiTexture)
{
if (texture)
{
glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);


glBindTexture(GL_TEXTURE_2D, texture->tex);

}

else glDisable(GL_TEXTURE_2D);
}

if (multiTexture)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture->tex);


glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture2->tex);
}



This didn''t change the problem. Basically, here''s what''s happening...

I am drawing 2 squares.

if square 1 has multitexturing working and square 2 does not then whatever the first texture that square 1 was using square 2 will use that same texture no matter what.

But if I set square 2 to multitexturing (set it to true so it uses the multitexturing code above) then it will use the textures that I set it to.


A CRPG in development...

Need help? Well, go FAQ yourself.


"I''m gay, please convert me." - Nes8bit

Share this post


Link to post
Share on other sites
You cannot pass GL_TEXTURE?_ARB to glDisable (if you check glGetError, it should complain about that). You must use glActiveTextureARB to switch to the unit you want to disable and then use glDisable(GL_TEXTURE_2D). Also, be sure to switch back to unit 0 at the end of disabling multitexturing.

Share this post


Link to post
Share on other sites

  • Advertisement