Colors Adjusted When Using Textures?

Is it normal to see all regular colored quads adjust their color/alpha values according to recently loaded textures? It doesn’t sound right at all, but for some reason it’s what I’m getting.

To be very specific, this is what happens: I call GL11.glEnable(GL11.GL_TEXTURE_2D), nothing happens, my screen draws normally. I then call textureLoader.getTexture(“somepic.png”), store that result to a Texture instance, do nothing else with it, and suddenly all the colored shapes I was drawing seem to be based off of the color of the top left pixel of the image I just loaded. Although they are not quite the same color, their usually a little darker or a slightly different hue depending one what color I meant it to be. I can’t quite figure out exactly what the pattern is, as loading a green image turns white triangles into some ugly pale yellowish slightly green color. The textures draw fine, it’s just the regular shapes which are messed up.

I’m currently using the TextureLoader class from the Kev’s Space Invaders tutorials and my initialization code is as follows:

Display.create();
GL11.glViewport(0, 0, WIDTH, HEIGHT);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);				
GL11.glLoadIdentity();
	        
DisplayMode mode = Display.getDisplayMode();
GL11.glOrtho(0, mode.getWidth(), 0, mode.getHeight(), -1, 1);

I’m just using plain glVertex2f() between glBegin() glEnd() calls for the vertices, pushing/popping the matrix seems to have no effect on the problem.

Is this a known issue and I’m just supposed to “deal with it” by drawing everything in textures? Or have I just done another stupid newbie mistake?

I only recently figured out this problem as much as I have described above. For a while I was using a partially transparent texture where the top left corner had an alpha of 0 and it was drawing my whole screen as black and it was driving me crazy. Any help understanding this would be appreciated, this has to have come up before at some point.

The color that is rendered is by specification ‘undefined’, so when you are not passing texcoords along with your vertices, you have to glDisable(GL_TEXTURE_2D) again.

Ah, didn’t know you could do that, thought you specified that stuff only once at the beginning of the code. Works perfectly now, thanks for the quick reply! :slight_smile: