Advertisement

glLookAt vs. glTranslatef

Started by July 16, 2004 11:17 AM
12 comments, last by python_regious 20 years, 7 months ago
Also, if you're going to use gluLookAt, you might as well just do it yourself, as gluLookAt really isn't hard to implement. All you have to do is multiply the modelview matrix by this:
[ Sx Sy Sz -Px ][ Ux Uy Uz -Py ][ Fx Fy Fz -Pz ][  0  0  0  1 ]


Where S, U, F and P are the side, up, front and position vectors respectively, that define the camera frame.

Pretty easy isn't it? [smile]
If at first you don't succeed, redefine success.
It does not matter if you transform/rotate the MODELVIEW or the PROJECTION matrix. The result should be the same.
The only real difference is that transformations of the MODELVIEW matrix allow to transform single simples/objects, whereas the PROJECTION matrix always affects all simples/objects. That is only logical, because when you walk around the scene all objects should be transformed accordingly to yield a view from a given angle.
Advertisement
Quote:
Original post by GOD anubis
It does not matter if you transform/rotate the MODELVIEW or the PROJECTION matrix. The result should be the same.
The only real difference is that transformations of the MODELVIEW matrix allow to transform single simples/objects, whereas the PROJECTION matrix always affects all simples/objects. That is only logical, because when you walk around the scene all objects should be transformed accordingly to yield a view from a given angle.


Actually using the PROJECTION matrix causes other issues. Keep it in MODELVIEW.

Quote:
Original post by GOD anubis
It does not matter if you transform/rotate the MODELVIEW or the PROJECTION matrix. The result should be the same.
The only real difference is that transformations of the MODELVIEW matrix allow to transform single simples/objects, whereas the PROJECTION matrix always affects all simples/objects. That is only logical, because when you walk around the scene all objects should be transformed accordingly to yield a view from a given angle.


Oh wow, I never thought of doing that. Cool! [smile]
If at first you don't succeed, redefine success.

This topic is closed to new replies.

Advertisement