Jump to content
  • Advertisement

Archived

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

ade-the-heat

can't put color on a sphere ! duh !

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

I use the following to draw a sphere. //save the current color glPushAttrib(GL_CURRENT_BIT); glPushMatrix(); glDisable(GL_TEXTURE_2D); glTranslatef(MAP_X*MAP_SCALE*0.5, 200.0, 50.0); glColor3f(0.3f, 0.3f, 0.3f); gluSphere(g_Sun, 15.0, 60, 80); glEnable(GL_TEXTURE_2D); glPopMatrix(); glPopAttrib(); It draws correctly and in the right place - but it''s always what looks like white in color. I''ve tried changing the glColor3f call to every values I can think of but still the color is white. There''s obviously something stupid going on and normally the colors are as I want them !! So what am I doing wrong ? cheers

Share this post


Link to post
Share on other sites
Advertisement
glEnable(GL_COLOR_MATERIAL);

is your new best friend.


"Unfortunatly, when I sent the email, instead of writing "Best Regards" I ended up writing "Best Retards." - boolean

Share this post


Link to post
Share on other sites
or

glDisable(GL_LIGHTING);
.
.
.
glEnable(GL_LIGHTING);

"Give a man a fish and he will eat for a day, drown a man in the water and the fish will eat for a week!

Share this post


Link to post
Share on other sites
quote:
Original post by cmptrgear
or

glDisable(GL_LIGHTING);
.
.
.
glEnable(GL_LIGHTING);

"Give a man a fish and he will eat for a day, drown a man in the water and the fish will eat for a week!


But then the sphere won''t be shaded, and I really don''t think the OP wants that...


"Unfortunatly, when I sent the email, instead of writing "Best Regards" I ended up writing "Best Retards." - boolean

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!