Rotated monitor/projector?

Hello Everyone,

I’m coding a rather simple opengl program (also using glut) that creates an interactive vr-enviroment. At present, you can use a mouse/keyboard to move around, etc.

We have a back-projected display that I’d like to use, except for the fact that the projector is physically rotated onto it’s side, like rotating a monitor on it’s side.

I’m curious if there is a simple way to rotate the viewport without having to change all of the axis mappings… (meaning x is now y, etc). I’d like to be able to throw in a command-line flag that would automatically rotate the display in the future.

If you need more information, please let me know.
Thank you again.


Hi Mike. A fellow EVLer!

You can apply a rotation to the modelview matrix to account for the rotated display device. If you don’t want to touch the modelview, you can equivalently apply this rotation to the projection matrix. Carrying this to its extreme, I wrote a rather lengthy document on the topic, going into significantly greater depth and generality. This approach handles arbitrary screen orientation and arbitrary viewer position, as is necessary in VR. There’s code here you can copy and paste if you like.