Jump to content
  • Advertisement
Sign in to follow this  
UtkarshGaur

OpenGL Need help on a very simple prob

This topic is 4394 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 a newbie to OpenGL. I have drawn a disc using glu and now i want it to be lit from both the sides( by default only one normal is defined which makes it glow from one side only :( ) I know its simple for u guyz..... but it would b a gr8 help to me thnx

Share this post


Link to post
Share on other sites
Advertisement
Though I've never messed with it myself, I think you need to enable 2 sided lighting, a google would probably tell you how, hope that helps :)

Share this post


Link to post
Share on other sites
there can be many ligths, but a surface(or vertex) only needs one normal. just position the lights correct, and it lights up on the sides where the ligths are.

Share this post


Link to post
Share on other sites
If I understand your problem correctly, you want both sides of each face to be lit. As Thought suggested, this is a setting that can be modified.
Try:

glDisable( GL_CULL_FACE );

This should make sure both sides of every face are drawn. Then, don't specify normals when you are drawing. This "should" draw them both equal. I'm not sure how this is defined if you specify lights, though. If you disable lighting, though, I would think that this would work for you.

If there are different / better solutions (there most likely are) please feel free to correct me.

- Enosch

Share this post


Link to post
Share on other sites
Quote:
Original post by Enosch
If I understand your problem correctly, you want both sides of each face to be lit. As Thought suggested, this is a setting that can be modified.
Try:

glDisable( GL_CULL_FACE );

This should make sure both sides of every face are drawn. Then, don't specify normals when you are drawing. This "should" draw them both equal. I'm not sure how this is defined if you specify lights, though. If you disable lighting, though, I would think that this would work for you.

If there are different / better solutions (there most likely are) please feel free to correct me.

- Enosch
You're right that face culling will need to be disabled to see the back faces, but what Th0ughtCr1me was referring to is two-sided lighting. You can set this with glLightModel*.

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!