PDA

View Full Version : setting camera position



11-26-2002, 11:09 PM
this may seems dumb, but cant help it. My proj. Anyone has any idea how to set the camera position without using Opengl, ie glulookat? My aim is to use the equivalent matrix generated by glulookat instead of the actual command itself. The prob is wat do I mutliply with the matrix to set the camera position. Thx

nexusone
11-27-2002, 04:22 AM
I not sure of the matrix math, but you can do the same thing as glLookAt by using glTranslate and glRotate.

So a translate would be add/sub function in matrix math.

And rotate is a more complex, I guess a sin/cos function in the matrix.



Originally posted by City-Hunter:
this may seems dumb, but cant help it. My proj. Anyone has any idea how to set the camera position without using Opengl, ie glulookat? My aim is to use the equivalent matrix generated by glulookat instead of the actual command itself. The prob is wat do I mutliply with the matrix to set the camera position. Thx

GameMaker
11-27-2002, 05:48 AM
Multiplying your model vertices by the model matrix is how you "move" the camera. Moving the model away from the camera is equivalent to moving the camera away from the model (in the opposite direction). Same kind of thinking for rotating the camera also.

11-27-2002, 06:03 PM
Thx for the prompt reply. Appreciate it. So let me get this straight. To simulate a camera setup, all I need to do is perform matrix transformation on my model, is tt right? So how do I initialise my original view, ie. let's say, without glulookat, how do I specify where is my original camera position,ie let's say, I wanted my camera to be placed at the observer's view. How do I tell the program that I wanted that point as my camera? Perhaps I miss out some details in your explanations.