Trying to move a Camera

Hello,

I am trying to move a Camera using sine’s and cosine’s, but I don’t know where to start. I am using glLookAt(), but how would I program the rotation to use my defined variable that contains my sine’s and cosine’s.

  • VC6-OGL

Hi !

If you are using sin and cosine I assume that you want to rotate the camera in some way ?, in that case why not use glRotate instead ?

Mikael

How would I setup glRotate to use my sin and cosine’s?

  • VC6-OGL

Are you trying to move the camera along a cos or sin wave or rotating the camera?
if moving along:
glulookat has params that are the position of camera. Change those params according to your wave equation
if rotating the camera:
glulookat has params that are the position in 3d space the camera looks at. Use rotation formula to rotate those coordinates and the camera will turn.

I dont know if I helped. More help can be located at www.gametutorials.com.

Originally posted by VC6-OGL:
[b]How would I setup glRotate to use my sin and cosine’s?

  • VC6-OGL[/b]

its very much simple to transform the camera in any desired direction or location or orient it, simply calculate the sin or cos values and stored in some variable and use those variables in glRotatef() if u want it to rotate or glTranslatef() if u want it to move somewhere.

I believe that the most appropriate way is to use some Matrices.
Try to make up some Matrices from your sin and cos and then multiply tha Modelview matrix.