Skip to main content
GameDev.net gamedev.net
🔒 Locked

gluLookAt() function !!!

Started by arkansas Dec 5, 2002 at 6:27 AM 5 replies 350+ views
Original Post
arkansas
arkansas
hey.. I got some problems with the gluLookAt() funtion. Ok.. if I had an object moved to glTranslatef(0.0f,-20.0f,-100.0f); how am I supposed to set the values in the LookAt func. I tried and tried and all I see is a black screen. Makes no since. first 3 parameters are camera position. I set it on: (0.0,0.0,100.0) and the second 3 parameters are where it is supposed to look at. I set it on: (0.0,-20.0,-100.0); I don''t know exactly what the last 3 parameters are there for, but I set them on: (0.0,1.0,0.0); What am I doing wrong... ?? or did i forget something ?
arkansas
arkansas
hmm...

Well, but I would like to try it. Even if I don''t really need it, but I wanna try it out.
So.. can somebody help me with that.

arkansas
knyot
knyot
Your first two vectors are right. The last vector is the up vector telling the camera which way is up. The values you have should be fine. You might want to check your gluPerspective() function call. You might be farther away from the object than you can see. The last value in that function call is the distance when OpenGL stops drawing things. You can look up what the rest are.

knyot
arkansas
arkansas
Hi

My gluPerspective is set up to 500.0f. Should I move the whole object bac to the origin? Is the camera influenced by the glTranslatef function?

I don''t why its not working.
knyot
knyot
is your object too big/too small? are you sure it is rendering? make sure the object is drawn then try debugging by adding variables for the gluLookAt function that you change by pressing the arrow keys. draw the object so you can see it, then move the camera around to see what happens.
arkansas
arkansas
oooohhhh.. thanks dude haha
I didn''t let him draw the object. *smile*
thanks...

arkansas

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.