Advertisement

gluLookAt problems

Started by April 21, 2000 02:54 AM
1 comment, last by Magallo 24 years, 6 months ago
Hello world, this site is great, Nehe rules!!! Now the problems..... I draw a cube into the DrawGLScene like this glClear(GL_COLOR_BUFFER_BIT / GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0f,0.0f,-5.0f); glRotatef(yrot,0.0f,1.0f,0.0f); //draw the cube ....... ....... and all is ok. Now I want to implement camera movements trought the gluLookAt function like this glClear(GL_COLOR_BUFFER_BIT / GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(eye.x, eye.y, eye.z, 0.0f, 0.0f, 100.0f, 0.0f, 1.0f, 0.0f); glTranslatef(0.0f,0.0f,-5.0f); glRotatef(yrot,0.0f,1.0f,0.0f); //draw the cube ....... ....... Where eye.x,eye.y,eye.z are initialized at 0.0f But I can''t see the cube...... why ? I mean, it is exaclty 5 units BEHIND and not IN FRONT of me! If use change the instruction glTranslatef(0.0f,0.0f,-5.0f); with glTranslatef(0.0f,0.0f,5.0f); now I am able to see it. WHY ?!?!??! Please, somebody help me Thanks in advance Magallo tripuno@tiscalinet.it
Without using gluLookAt() you look in the direction of the negative Z axis. With your gluLookAt() call you look in the direction of the positive Z axis.

Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA
Advertisement
I posted a similar question to yours about 7 days ago:

http://www.gamedev.net/community/forums/topic.asp?topic_id=11720&forum_id=27&Topic_Title=lookat%28%29+my+sad+math+skills&forum_title=NeHe+Productions&M=False&S=True

It has some very detailed descriptions to WHY it disappears.
This Space Left Blank

This topic is closed to new replies.

Advertisement