Search code examples
copenglcamerafreeglutglulookat

Camera will not move in OpenGL


I am having problems with using a camera in OpenGL/freeGLUT. Here is my code:

http://pastebin.com/VCi3Bjq5

(For some reason, when I paste the code into the code feature on this site, it gives extremely weird output.)

As far as I can tell this should rotate the camera when arrow keys are pressed - but it does nothing. It also seems that even the initial camera position is wrong. Any clue why this is?


Solution

  • The display function is only called once. You need to either set an idle function with glutIdleFunc() or tell GLUT that the display function must be called again with glutPostRedisplay().