Move and Rotate camera

SummerLand
Unregistered
 
Post: #1
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
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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 Wink

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.
Quote this message in a reply
Feanor
Unregistered
 
Post: #3
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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cube auto-rotate sakrist 2 3,106 May 5, 2009 03:31 AM
Last Post: Ingemar
  rotate to focus on objects szgezu 1 2,071 Mar 4, 2006 03:59 AM
Last Post: SOUCHAN
  How does one rotate a scanned image in openGL? WhatMeWorry 16 8,765 Feb 2, 2005 09:25 PM
Last Post: arekkusu
  Best way to rotate an object Jake 12 4,488 Jul 30, 2003 01:09 PM
Last Post: Jake
  rotate and translate opengl difficulties furballphat 2 4,288 May 24, 2002 05:19 PM
Last Post: furballphat