I have a sample 3d scene rendered using OpenGL ES 1.1. Here is what I get when I have identity projection matrix (I'm also using normal and specular maps):
So everything looks OK.
But if I set perspective using glFrustum
I get this:
So it seems that normals are being inverted and if I try to multiply them by -1 I get this:
It has an effect like the light was from the opposite side.
I should also mention that when using identity proj开发者_JAVA百科ection matrix I have to set
glCullFace(GL_FRONT);
(I think this is because normalized device coords are left handed).
I'll be happy to hear any suggestions about how to fix this issue.
Edit. here is the projection setup:
float right = 0.03;
float top = 0.045;
float near = 0.1;
float far = 100.0;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-right, right, -top, top, near, far);
Your second screenshot looks okay, I don't see where your problem is. please highlight in the second picture, what you think doesn't look right.
Remember that in the projection matrix there should only be the projection, and kind of camera placement at all. The "camera placement" belongs into the modelview.
精彩评论