Jump to content
  • Advertisement
Sign in to follow this  
Subotron

normal texturing doesn't work after multitexturing

This topic is 4169 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 added some code to my project where I use multitexturing to bumpmap an object. This works fine, however, when I draw my regular objects (just one ms3d model atm) the textures don't get bound, and the already active texture is used instead. For multitexturing, I use glActiveTexture(GL_TEXTURE0_ARB), and the same for texture unit 1 and 2. I bind the textures from my ms3d model using glBindTexture(GL_TEXTURE_2D, texture); glEnable(GL_TEXTURE_2D); this is without any glActiveTexture call, so I made sure I disabled to texture unit 1 and 2 (and tried 0 as well). However, I just can't get the textures to bind for the model when the multitexturing code is enabled in the workspace. Any idea how come? I can post code if needed.

Share this post


Link to post
Share on other sites
Advertisement
try glpush attrib before and popattrib after multitexture to see if you forgot to restore some other opengl state. also, it could be a shader you used for bump mapping you forgot to turn off.

Share this post


Link to post
Share on other sites
Quote:
Original post by Subotron
I can get it to work that way, but I still don't know what I am doing wrong.


I had a similar problem a while ago but I'm not quite sure how it worked, I think I solved it using a glEnable/glDisable for each glActiveTexture()...
something like:


// Multitexturing...
glActiveTexture(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, texture1);
glEnable(GL_TEXTURE_2D);
//...
glActiveTexture(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, texture2);
glEnable(GL_TEXTURE_2D);
//...
glDisable(GL_TEXTURE_2D); // disable for GL_TEXTURE1_ARB
glActiveTexture(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D); // disable for GL_TEXTURE0_ARB

//...
// Use a single texture...


Share this post


Link to post
Share on other sites
that's the weird thing, that doesn't work here. Is it absolutely necessary to disable the textures by disabling the highest (e.g. when you have 3 texture units, 3 = the highest) texture first? Cause that might be the problem, although I don't think it is.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!