PDA

View Full Version : textures and colors



m3xican
03-13-2008, 05:11 AM
Hi,

When I enable texturing (glEnable(GL_TEXTURE_2D), for example), colors of all the graphic primitives (points, lines, triangles, etc...) are affected by the latest bound texture, even if I don't associate any texture coordinate to the vertexes nor activate a texture unit.

This could be a problem, for example, when I want to draw just a triangle mesh with no textures.

I've sorted this issue out in two ways:
- disabling texturing
- binding the texture name 0 (or some other texture name never created)

Does exist some other way to manage this problem?

eggzcape
03-13-2008, 05:44 AM
From what i know, you should unbound the texture with glBindTexture(target, 0); if you don't want to use it.

Zengar
03-13-2008, 05:47 AM
This is not really a "problem", because texturing is designed this way. If texturing is enabled, OpenGL will apply it. It doesn't matter weather you specify texture coordinates or not -- as OpenGL is a state machine, it will always found some texture coordinates. So just disable the texturing.

m3xican
03-13-2008, 06:12 AM
Thank you guys.

I know it's not a real problem, I used that word because it's not the behavior I need, but I know this is the usual way for OpenGL, and now I'm sure I'm doing well with that.

Thanks for the quick replies!