OpenGL textures rendered onto a quad?

Ok so I know how to render a texture on a quad, thats not what I’m asking here. It appears that if I initialize a texture (loaded with Slick Util library) and then try to draw a quad, some weird stuff takes place. I never called glColor3f or glColor4f, and I didn’t write any shaders, so you would think the color of the quad would be white right? WRONG! It uses one of the colors from the texture I loaded. This is kind of hard to visualize so here’s some pseudocode:

Texture texture = new Texture(“blue_texture.png”);

//didn’t bind, or use the texture in any way

glBegin(GL_QUADS);
(specify 4 vertices here)
glEnd();

Output: blue quad

Why is the quad using the color of the texture? Even if I do specify a color, it still uses the one from the texture. Blending is enabled btw. Any way to avoid this?

glBindTexture(GL_TEXTURE_2D, 0) would be the easiest fix.
There might be a bug in Slick where it doesn’t unbind the texture.

EDIT:
OpenGL Texture Loading (under the hood):


int texture = glGenTextures();
glBindTexture(GL_TEXTURE_2D, texture);
// Load texture, blah blah
glBindTexture(GL_TEXTURE_2D, 0); //Maybe this is missing?

Yeah that fixed it right up. It’s weird though, because I never even bound the texture in the first place, so I geuss when it’s initialized, the bind() method is immediately called? At least its fixed now. Thanks!

You create a texture by binding it and uploading data to it. That’s what [icode]Texture texture = new Texture(“blue_texture.png”);[/icode] must do internally.