Camera

Started by
4 comments, last by Umpe 16 years, 1 month ago
Hello, I'm wondering about how to move the camera. I have looked at Nehe's guide, where you're supposed to move "everything" exept the camera, but I'd like to know if there are any easier way's to do it? Is it much harder to move the camera instead?
Advertisement
If you want an easier conceptual way to move the camera, try gluLookAt().

For example: gluLookAt(10, 5, 1, 7, 8, 2, 0, 1, 0);

That means the camera will be positioned at (10, 5, 1), will look at the coordinates (7, 8, 2), and will be looking at the coordinates with the y-axis up.

You should check out the documentation for it to understand it better.
Thx. Just what I was looking for.
problems again... Is the camera supposed to move every time I run gluLookAt()? 'cause mine dousn.t:(
What do you mean ? The gluLookAt simply sets the modelview matrix. Pseudocode for simple display loop:

do loop  glClear(...  // clear buffer here etc.  glMatrixMode(GL_MODELVIEW)  glLoadIdentity() // reset the modelview matrix  gluLookAt(... // sets the camera  ...  // draw your objects and scene here  ...  // swap buffers if doublebufferingend loop

ohh.. Now I know what's wrong. Didn't clear:D

This topic is closed to new replies.

Advertisement