Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Magallo

gluLookAt problems

This topic is 6941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!