OpenGL: Loading a texture changes the current color -


I noticed that when I am loading a texture, then changing the current drawing color, depending on the color of the texture After the example execution

  glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB, info.biWidth, info.biHight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmap); GlTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); GlTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);  

All consecutive polygons drawn on the screen will have a color based on the image of the texture.

Is that standard? I did not find this behavior document.

Yes, how it works, remember that GL is a state machine, so you have texture Left (and potentially capable) left, so when drawing, first pixels (you do not consider any textures coordinates) use primitive colors.

To solve this, when you do not want texturing, you can do it like this:

  glDisable (GL_TEXTURE_2D);  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -