Colours and textures

Started by
3 comments, last by Daaark 15 years, 9 months ago
Hi All I'm wanting to use both ordinary RGB colours as well as textures for the objects that I'm using in my OpenGL program. The problem is, for the objects that I just want to use RGB colour values for, it is instead covered with the previous binded texture rather than the colour I assigned it. Is there any way to over come this? Thank you in advance. Andrew
Advertisement
Bind to texture id zero before drawing the object
To enable textures you usually call glEnable(GL_TEXTURE_2D), so to disable them you call glDisable(GL_TEXTURE_2D).
Hi

Now I get the other problem of that the whole game scene I've created is covered with the colour I'm colouring the object with the RGB colours. Below is code I'm using to assign RGB colour to object:

glBegin(GL_QUADS);
glColor3f(0.0f, 0.0f, 1.0f);
myTransit.constructShape();
glEnd();

This code is called after all textures to other objects have been applied.

The result of this code is that the whole game scene turns blue :-(
The whole scene turns blue because the state of the color is blue. OpenGL is a state machine. Anything you toggle stays that way until you turn it off again. So change the color back to whatever your default is before continuing.

This topic is closed to new replies.

Advertisement