1

I am trying LookAt in OpenGL ES,

    gluLookAt(512, 384, 2000,
              512, 384, 0,
              0.0f, 1.0f, 0.0f);

The second row is the Target's position... so I wonder, if I change the z from 0 to 1000 or -1000, shouldn't what is seen different? They turn out to be all the same, why is that?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Jeremy L
  • 3,770
  • 6
  • 41
  • 62

2 Answers2

3

From the OpenGL spec for gluLookAt, it states the inputs as:

gluLookAt(GLdouble eyeX , GLdouble eyeY , GLdouble eyeZ , 
          GLdouble centerX , GLdouble centerY , GLdouble centerZ , 
          GLdouble upX , GLdouble upY , GLdouble upZ );

Your current values only move the center vector along the z plane so you're actually looking down from your eye vector. Depending on what it is that you're rendering, you might not see any change at all (a cube will look the same from either the top or the bottom).

Try changing your x and y values instead to move the camera to that it is not perpendicular to the vector you're trying to look at.

Jeremy L
  • 3,770
  • 6
  • 41
  • 62
Zack Brown
  • 5,990
  • 2
  • 41
  • 54
1

As the x and y coordinates are the same for the camera and the target, changing the z coordinate doesn't affect the direction that the view is in at all and for the purposes of this it's only the direction that matters.

jcoder
  • 29,554
  • 19
  • 87
  • 130
  • aha, I thought things might become smaller or bigger... but it is only a direction thing huh... – Jeremy L May 17 '12 at 12:45
  • The only things that would effect that would be the location of the thing you are looking at, and the position of the camera... The location of the thing you've fixed your eye on does not affect how big things look – jcoder May 17 '12 at 12:59