Jump to content
  • Advertisement
Sign in to follow this  
AverageJoeSSU

glActiveTexture and BindTexture

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

Last night i ran into some issues with these two commands. I have two render pipelines (one default and one deferred) which call the same render function, and one uses a normal map and one doesn't. after the code i unbind stuff by setting the active texture and binding 0. this was causing my font to not show up because it doesnt set an active texture, it just binds a texture. I am not sure why this caused a problem since it doesnt really matter which texture was active at that point. (once i set an active texture for the font it worked fine =/ ) I was wondering why this is, and what is good practice for using these guys together.

Share this post


Link to post
Share on other sites
Advertisement
There's no way to unbind a texture from a texture unit. Binding texture ID 0 does just that; binds another texture. Although it may appear to work as expected, you have to keep in mind that if you don't explicitly disable texturing, it will be enabled no matter what textuer ID you bind.

Sounds a bit to me, if I understand you correct, that the problem is actually related to leaving texture units enabled instead of actually disabling them, which is what you really want to do.

Share this post


Link to post
Share on other sites
This can also be a problem of mixing shaders with fixed function. Shaders ignore the enabled state for texture units, as you specify with uniforms which unit they draw from. Fixed function does respect the enable states, so you need to be careful in mixing them.

Share this post


Link to post
Share on other sites
I see.

Is it good practice to be enabling and disabling textures every time you want to bind something in your pipeline?

and i agree that it is a bit sketchy having fixed function and shaders in the same render function, but the deferred pipeline is barely off the ground and we still need the forward renderer as a fallback. i managed to get it working, just obviously misunderstood it.

Share this post


Link to post
Share on other sites
Yes you should disable a feature you don't need after you are done with it or else start push/popping attributes...

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!