PDA

View Full Version : gluLookAt an' the Up vector



02-18-2004, 12:54 PM
Anybody knows how to set the Up vector, to look up. I mean something like this:
gluLookAt(0,0,0, 0,1,0, upx, upy, upz);
The Up vector can't be (0,1,0), because the results are very uncool, so what shuold I put as this vector???

brcain
02-18-2004, 01:18 PM
Originally posted by Nut Cr4ck3r:
The Up vector can't be (0,1,0)

The up vector makes since if you think of the following example coordinate system ... looking at an OpenGL window with lower-left being the origin: x increases to the right, y increases up, z increases towards you.

[This message has been edited by brcain (edited 02-18-2004).]

[This message has been edited by brcain (edited 02-18-2004).]

02-19-2004, 10:51 AM
So if I want to look up (and see some geometry), then I should set up vector to let's say (0,0,-1)? And nothing else?

brcain
02-19-2004, 11:09 AM
It actually depends upon your geometry. http://www.opengl.org/discussion_boards/ubb/smile.gif I suggest reading Chapter 3 - Viewing of the OpenGL Programming Guide. There are several examples that utilize gluLookAt().

HamsterofDeath
02-19-2004, 11:41 AM
so if i walk on a sphere, my position has to be the up vector if i want the sphere to at the bottom ?

[This message has been edited by HamsterofDeath (edited 02-19-2004).]

coder1
02-19-2004, 11:58 AM
This doesn't really answer the original, but I messed with the last three params of gluLookAt() before, thus the Up vector, and it eventually lead me to the gimbal lock. just a note. Correct me if i'm wrong, this gimal lock will attack once you try to do something like this:

[QUOTE]Originally posted by HamsterofDeath:
[B]so if i walk on a sphere, my position has to be the up vector if i want the sphere to at the bottom ?

But if you got this fixed then there's no problem.