Hey Y’all,
I’m in my graphics class this quarter. All is going well until I ran a sample program from the book (i’m running openGL and GLUT on a windows machine). Anyway I run this program and it’s just suppose to give me a static room with a table. It does until you get another window (any window for that matter) anywhere near it and KABAM rotation starts happening. It’s really making me upset and no fun at parties.
//THIS IS THE LINE OF MY ANGST!!!
gluLookAt(23, 13, 20, 0, .25, 0, 0, 1,0);
Okay. I take gluLookAt out and everything works splendid. I can put any window I want in front of the window and live hapily ever after. With gluLookAt in place the thing rotates into a hellacious abbyss.
The problem is that you don’t set your matrix to the identity with glLoadIdentity() before you call your gluLookAt(). Thus, the gluLookAt calls are actually multiplying the current matrix, giving the cumulative rotation effect. The reason that it doesn’t happen until you move another window over your window is because glut is smart and doesn’t redraw your window until it has to.