What matrix to flip vertically?
Pardon my OpenGL ignorance. I looked up chapter 3 in the Redbook and did a forum search but am not finding the answer to a simple question:
If i have a 2D game in ortho mode, and it currently displays like this:
and i want to flip it vertically like this:
what matrix do i need to multiply it by? Or can i do that? The redbook didn't have them labeled (or i missed it) and matrices don't jive with my thought process well. Bonus points if you can explain why it works.
Thanks for your help. I need it!
Try a glScalef(1, -1, 1) on the orthographic projection matrix, that should do the trick (at least, if you're using symmetric coordinates). This will relocate the origin for every render operation you'll do. If you just want to do it for a set of primitives, flip the model view matrix.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement