Jump to content
  • Advertisement
Sign in to follow this  
Windfall

OpenGL Clumsy lighting

This topic is 4446 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, I had to write two similiar programs in openGL and DirectX. In openGL lights are very 'quadratic'. Here is the screenshot: openGL while in directX are ok - it's the same object loaded: openGL What can cause the problem ? Many thanks Bartek

Share this post


Link to post
Share on other sites
Advertisement
OpenGL does, by defualt, Per-Vertex lighting. I have no experience with DirectX, but it appears that DirectX does per-pixel lighting. If you want to do per-vertex lighting in OpenGL, you're going to have to write a shader for it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
OpenGL does, by defualt, Per-Vertex lighting. I have no experience with DirectX, but it appears that DirectX does per-pixel lighting. If you want to do per-vertex lighting in OpenGL, you're going to have to write a shader for it.


Nope, DX does per vertex. Looks to me a problem with your normals, do you know what they are?

Share this post


Link to post
Share on other sites
It looks like the normals aren't unit length to me. To check, put a glEnable(GL_NORMALIZE); somewhere in the init code and see if it works.

Share this post


Link to post
Share on other sites
Hi, unfortunetly it doesn't work :( I know that normals are normalized, even if I enter glEnable(GL_NORMALIZE) it looks the same. I am wondering if I shouldn't set something for device, but have no idea what.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
maybe you're culling front-faces, see if glFrontFace(GL_CW) helps?

Share this post


Link to post
Share on other sites
Yes! Looks far more better:

openGL

There is some roughness in lighting during rotations, can I use it also for back faces ?

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!