0

I have following code :

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt (0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.1, 20.0);
    glRotatef ((GLfloat) 45, 0.0, 1.0, 0.0);
    glRectf(-1,-1,1,1);

the rectangle will be rotated around y-axis. As my result shows, it is still at the center of my window. But why ?

As I know, the function gluLookAt modified MODELVIEW matrix and it issues calls to glTranslate inside, so whtat's the exactly behavior of the above glRotatef call? why the rotation radius is not 10? (10 is the 3rd param passed to gluLookAt)

genpfault
  • 51,148
  • 11
  • 85
  • 139
suitianshi
  • 3,300
  • 1
  • 17
  • 34

1 Answers1

0

I was looking for the reason why my object couldn't self-rotate when I saw you code. In my code, I put glRotatef before gluLookAt, which is the only difference from you code. I tried to change the order and it started to self-rotate. Try to change the order of two functions in your code and see what it looks like. I don't really know the reason. Hope someone can explain it.