origin and coordinate axes in window

Hello,

I’m relatively new to OF; just getting my hands messy for the moment. Its looking fun so far.

I come for a pretty heavy OpenGL background so I was a bit curious when I discovered that the polygon example uses an origin in the upper-left of the window (rather than OpenGL’s default of lower-left) and with a “reversed y-axis” (y increasing as you go downward, rather than upward.)

I’ve found this coordinate alignment when working with video so I’m not completely surprised to find it elsewhere. I was curious whether or not it is the default for OF. Is this the case? If so, is there a parameter that can be flipped to use lower-left origin instead? I just want to have an idea of my options before I start mixing in calls.

Thank you, happy to finally be trying this out.
-b

Hi

Yes. This behaviour is the default one. Probably because of was more focused on 2d in the beginning and having the upper left as origin is commonly used in graphical software like illustrator etc…

you can take a glimpse at the opengl viewport settings here:
https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/gl/ofGLRenderer.cpp#L269

Thank you for the context! For work like this I’m more than happy to “peer down the rabbit hole”.

also in 007 you’ll have the option to choose by passing the vflip parameter to false to ofSetupPerspective.

you can actually set the viewport and matrices as you want by doing the necessary calls in update or draw and disabling the default ones with ofDisableSetupScreen

Sweet. At some point I may end up doing that but for now I’m content with just making the adjustments to the scenegraph as I see fit. If I ever do anything intended for other platforms in addition to OF I can definitely see that being helpful.

How do you modify this ofSetupPerspective function to change vFlip to false? I tried editing directly the ofGLRenderer.h directly but it does not work. It goes back to vFlip=true ‘automatically’