Bug in texture loading?

Started by CuppoJava, March 21, 2005, 03:16:52

Previous topic - Next topic

CuppoJava

Hi,
I've just noticed something weird while going through Nehe's Lesson 06, that maps a bitmap onto a cube.

The weird thing is even if I do not use the texture, and just directly set the color using glColor3f, it doesn't show up as the color I want.

I tried glColor3f(1,1,1) and the cube rendered as blue. But after I commented out the line:

//    texture = loadTexture("Data/NeHe.bmp");

then the cube is correctly drawn as white.

Is this a bug in OpenGL or am I not understanding something. Its really bugging me in my game too, as whenever I load textures, my pearly whites turn into gray.

napier

You could try disabling textures when you want to draw with color (glDisable(GL_TEXTURE_2D)) and see if that helps.  

It sounds like the texture is overlapping with the color.  You can colorize textures on the fly by tweaking glColor().  It's not a bug, but can produce unplanned results if your're not expecting it.

I'm pretty sure that if you have texturing enabled (glEnable(GL_TEXTURE_2D)) then there is a default texture in effect even if you don't explicitly load one.
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl

CuppoJava

Thank you very much.
Turning on and off GL_TEXTURE2D did the trick. Now my colors are back to normal again.