View Full Version : glBindTexture() and "unbinding" a texture
02-11-2009, 06:08 AM
I have a strange issue where when I draw a texture and then draw some lines via GL_LINES afterwards, the lines don't show up in their correct color. If I put glBindTexture(GL_TEXTURE_2D, 0) after the texture draws, the lines use the correct color. Is this the right way to fix this, or is there a better way?
02-11-2009, 06:47 AM
1. you don't draw a texture. You map or apply a texture on a primitive (piece of geometry)
2. Lines are shown with the texture you applied on your previous geometry because you called glEnable(GL_TEXTURE_2D) at the previous step but you forgot to turn it off with glDisable(GL_TEXTURE_2D).
glDisable(GL_TEXTURE_2D) is the way (on the fixed-pipeline).
02-11-2009, 06:52 AM
Thanks. I come from Cocoa/Quartz so still learning the terminology :)
02-11-2009, 07:03 AM
If you don't want textured lines, you should do glDisable(GL_TEXTURE_2D); before drawn lines. Re-enable it before drawing texture.
02-11-2009, 07:17 AM
"glBindTexture(GL_TEXTURE_2D, 0) after the texture draws, the lines use the correct color. Is this the right way to fix this, or is there a better way?"
this is ok as well. what makes glDisable more attractive is that you can glPushAttrib it and glPopAttrib it back along with other attribs.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.