Sign in to follow this  
Windfall

OpenGL Clumsy lighting

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this