🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

how do you move the viewer

Started by
3 comments, last by Styles 23 years, 11 months ago
i have just recently started programming OpenGL with the help of NeHe tutorials. But how do you move the viewer or camera thanks
Styles peace!
Advertisement
You cannot move the viewer, thats impossible.
Instead move the the whole world

(btw. gluLookAt() or something like that
is the real answer to your question


There is no spoon.
There is no spoon.
I just tried implementing camera movement, with gluLookAt().

I am just using GLUT for keyboard input for now. I have it set up to add say 1.5(though I''ve tried all sorts of numbers) to xpos on a certain keypress, and likewise for other variables and keypresses.

However, when the program is running, pressing the key does not change the view at all. But, when I hard code the values and use them in gluLookAt() with the same variables it works fine.

I know the keypress code works, because I do it the exact same way I do other keypress functions, like when I hit f it goes fullscreen, and escape exits, and those work just fine, I don''t know why this doesn''t.

Any ideas?

do a break after youve pressed the key

xpos = 0
{press key}
{break}
xpos = 1.5
..
..
..
until u hit the glulookat function and see if xpos is still 1.5


Hi,

gluLookAt(5,5,5,0,0,0,0,1,0)

==> 5,5,5 = position of the eyes
==> 0,0,0 = where the eyes see
==> 0,1,0 = where''s the camera


To move in a 3D world, don''t use gluLookAt(), draw your world following the position of the player.

If it''s for a camera, change the place where the eyes look too.

Sorry for my english but i hope that you''ve understood

Leyder Dylan

dylan.leyder@ibelgique.com

========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/

This topic is closed to new replies.

Advertisement