Move and Rotate camera
How I can translate and rotate the camera in GLUT? I have tried to move and rotate all the other objects but the lighting don't works correctly. Thanks
The interaction between OpenGL lighting and the model-view matrix is quite difficult to grasp to begin with. The OpenGL red book has as good an explanation as any I've found, and even if you don't understand the explanation, it tells you outright what order to do things in 
An older version of the red book is available free online; you can find the link in the FAQ, off nehe.gamedev.net, or by searching Google.

An older version of the red book is available free online; you can find the link in the FAQ, off nehe.gamedev.net, or by searching Google.
Everything in OpenGL is relative, so moving the camera and moving the objects is the same thing, ultimately (that's why the MODELVIEW_MATRIX is one matrix and not two). I still get translations mixed up. Remember that glTranslate* moves the origin relative to the camera.
But if your lighting is wonky, maybe your normals aren't being specified correctly. That happens if you a) don't specify normals at all, b) specify them wrong, or c) forget to normalize them. Check out glEnable( GL_NORMALIZE ) and glEnable( GL_RESCALE_NORMAL ) if you haven't already.
--FĂanor
But if your lighting is wonky, maybe your normals aren't being specified correctly. That happens if you a) don't specify normals at all, b) specify them wrong, or c) forget to normalize them. Check out glEnable( GL_NORMALIZE ) and glEnable( GL_RESCALE_NORMAL ) if you haven't already.
--FĂanor
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Cube auto-rotate | sakrist | 2 | 2,627 |
May 5, 2009 03:31 AM Last Post: Ingemar |
|
| rotate to focus on objects | szgezu | 1 | 1,755 |
Mar 4, 2006 03:59 AM Last Post: SOUCHAN |
|
| How does one rotate a scanned image in openGL? | WhatMeWorry | 16 | 7,614 |
Feb 2, 2005 09:25 PM Last Post: arekkusu |
|
| Best way to rotate an object | Jake | 12 | 3,953 |
Jul 30, 2003 01:09 PM Last Post: Jake |
|
| rotate and translate opengl difficulties | furballphat | 2 | 3,546 |
May 24, 2002 05:19 PM Last Post: furballphat |
|

