PDA

View Full Version : Camera position...

Sig Wong
03-24-2005, 11:24 PM
I have not seen this done before. Maybe I am missing something obvious, but I want to be able to rotate the camera that is viewing objects. I have seen ways that objects themselves can be rotated, but none so far on how to rotate the "camera."

I am trying to make a 3d modeling, animation, and rendering app, and the modeler will need to view the object from all 6 sides, as well as rotate the view to see it from and angle around it. The positions of the vertices that compose the object(s) cannot be changed, or it will not work for obvious reasons.

also, I would need to have the ability to move the camrea from side to side.

One more thing (that I believe to be related) is that in the example that I have, glTranslated() is used before a given object is drawn, and then all the verteces after it are relative to the position it set. I need everything to be relative to the same position, otherwise the model would be impossible (or at least very difficult) to save.

-sig

jide
03-25-2005, 02:37 AM
Try to use gluLookAt (GLfloat eye_x, eye_y, eye_z, target_x, target_y, target_z, up_vector_x, up_vector_y, up_vector_z);

You'll have to do some mathematics to do the effects you want. But, to my point of view, this is the best solution.

pedrodx
03-30-2005, 03:08 AM
Hi! Take a look at the topic "Problem on moving eye coordinate", there are the formulas I posted!
See ya!!

mikael_aronsson
03-30-2005, 03:46 AM
Hi !

To be picky, the "camera" in OpenGL is fixed and cannot be changed in any way, when you rotate the "camera", you actually rotate all objects (oposite direction) instead to give the impression that the camera is rotated.

Mikael

agemenon
04-01-2005, 04:41 AM
At this point I want to ask something
glTranslatef(0,0,-5)
and
gluLookAt (0.0, 0.0, -5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
have the same efect on the object. When I use gltranslatef I change the object cordinates.
But does gluLookAt do the same? Does it change the object cordinates also...

mikael_aronsson
04-02-2005, 10:34 PM
Yes