Jump to content
  • Advertisement
Sign in to follow this  
leiavoia

OpenGL What matrix to flip vertically?

This topic is 4962 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
hey, that was simple enough. Thanks! I'm trying to write a wrapper that flips output text from FTGL without hacking FTGL to suit my needs. I think that's going a bit too far.

Thanks again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!