geometry in space

Started by
0 comments, last by Fratt 22 years, 2 months ago
hi all, i develop in opengl and a function keep these parameters: gluLookAt( eyex, eyey, eyez, aimx, aimy, aimz, upx, upy, upz); the param (eyex...) could be condidered as vectors with y the height in space. then my problem is for the up vector. this function is as a camera. then, if my up vector which place the orientation of the camera is not set correctly, the view is incorrect. how to set this up vector correctly according to the 2 other vectors ? the camera is set at horizontal but is inclined due to the vector formed by aim-eye. can someone help me (and almost understant what i want ?) thanx a lot Fratt
Advertisement
Remember that the second set of parameters is not a direction but a point.

i.e. ( 1, 0, 1, 0, 0, 1, 0, 1, 0 )

viewpoint in point ( 1, 0, 1 )
center looking at point ( 0, 0, 1 ), that is down vector ( -1, 0, 0 )
up direction is ( 0, 1, 0 )

The combination (cross product) of your ''up'' vector and ''forward'' vector (forward = center - viewpoint ) defines your ''right'' vector. The up vector must be provided to compute the missing vector, not the other way round.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement