Jump to content
  • Advertisement
Sign in to follow this  
Andrew1979

OpenGL Colours and textures

This topic is 3756 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
To enable textures you usually call glEnable(GL_TEXTURE_2D), so to disable them you call glDisable(GL_TEXTURE_2D).

Share this post


Link to post
Share on other sites
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 :-(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!