Advertisement

how do you move the viewer

Started by July 26, 2000 01:19 PM
3 comments, last by Styles 24 years, 3 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!
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.
Advertisement
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