Jump to content
  • Advertisement

Archived

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

LackOfKnack

OpenGL Some quick OpenGL help

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

Advertisement
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

glPushAttrib(GL_LIGHTING_BIT)
glDisable(GL_LIGHTING)
//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)
glPopAttrib()

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?

thankyoubye



-------------
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}

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

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




http://www.geocities.com/ben32768

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!