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?
- you don’t draw a texture. You map or apply a texture on a primitive (piece of geometry)
- 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).
Thanks. I come from Cocoa/Quartz so still learning the terminology
If you don’t want textured lines, you should do glDisable(GL_TEXTURE_2D); before drawn lines. Re-enable it before drawing texture.
“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.