Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Julio

OpenGL Coloring problem in OpenGL

This topic is 6639 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

howdy. here's an example of what I'm talking about.
        
...
DrawStuff();  //draws my objects

glColor3f(1.0f,0.0f,0.0f); //change color for sphere

glutSolodSphere(1,10,10);
...
        
when I change the color to red, the whole scene turns a redish tint. How do I just make the sphere red and not the whole scene? Thanks, Joe JoeMont001@aol.com Edited by - Julio on 6/15/00 12:10:07 PM

Share this post


Link to post
Share on other sites
Advertisement
Hi,
Do you reset the color after setting it to red, when you draw the next frame? Because he will do DrawStuff(); with red as current color, when you don''t switch back to the right color.

Share this post


Link to post
Share on other sites
Due to the fact that OpenGL is a state machine, you need to reset OpenGL''s colour state every time you change it (it remembers these things), if you want it back to normal that is.

so you''d have:

// you should probably clear the colour buffer before you
// do any drawing, that makes sure everything starts the same.
glClear(GL_COLOR_BUFFER_BIT);
DrawStuff(); //draws my objects
glColor3f(1.0f,0.0f,0.0f); //change color for sphere
glutSolidSphere(1,10,10);

// and whatever else

-Mezz

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Before that point in the program I never call glColor3f because everything else is texture mapped. So should I reset it to glColor3f(0.0f,0.0f,0.0f) ?
Thanks,
Joe

JoeMont001@aol.com

Share this post


Link to post
Share on other sites

  • 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!