Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm stuck on trying to figure out how to rotate the viewport(or camera). So far I've figured out I need to use the function glRotatef and glMatrixMode(GL_MODELVIEW). But I have no idea how to apply the rotations to the model view. I'm sorry I have no code to show because I have no idea how to get started. Any help would be greatly appreciated!

share|improve this question
Instead of rotating the camera, you can rotate an object as well. But for the reference, you can check out this project made by me. Hope this will clear most of yor queries. – Sid Dec 28 '12 at 11:49
You should just read any tutorial. – Bartek Banachewicz Dec 28 '12 at 13:41
What are you talking about. Most tutorials I find don't cover camera work... – opiop65 Dec 28 '12 at 15:22

glRotatef should apply to whatever matrix is currently selected by glMatrixMode. Just execute it after glMatrixMode.

It's worth nothing that glMatrixMode is a deprecated command. The new way of doing things involves using shaders, binding a matrix to them and multiplying them together with the vertex coordinates.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.