Jump to content
  • Advertisement


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


OpenGL Some quick OpenGL help

This topic is 6798 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 Lack,

I think the way to do it is to push the lighting attribute bit, disable lighting, draw your sun, then re-enable lighting for the rest of the scene (sorry, my brain''s gone all rusty ).

The code may look similar to this:

glPushMatrix() //save matrix state, in case you have a viewing transformation

//perform transforms for positioning sun
gluSolidSphere(...) //whatever it is to draw sphere
glEnable(GL_LIGHTING) //restore lighting for rest of scene

//probably a call to pop attribute here (can''t remember)

glPopMatrix() //restore matrix state

Sorry if this a little vague, but I think that''s the general approach. If it doesn''t work... um... give up?


squirrels are a remarkable source of protein...

Share this post

Link to post
Share on other sites
No, don''t do it like that... do it like this

float bright[4]={1,1,1,1}

glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, bright);
//draw your sun thing here

I''m using the same technique in my breakout-style game to make the powerups stand out from the rest of the blocks.


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!