normally in in opengl textures (0,0) is the bottom left of the image. But when mapping a texture to a plane in openframeworks you have to specify (0,0) as the upper left. Where in the code are the texture coordinates flipped?
This might help you a bit:
“Since OF uses what are called ARB texture coordinates, that means that 0,0 is the upper left corner of the image and 500,389 is the lower right corner. If you were using “normalized” coordinates then 0,0, would be the upper left and 1,1 would be the lower right. Sidenote: normalized coordinates can be toggled with “ofEnableNormalizedTexCoords()”.” from Joshua’s Tutorial
As for why they are flipped, I think it was a design decision to be more familiar with developers coming from processing.
As far as where it happens in the code, I believe there are many places, check ouf the ofTexture.cpp draw routines specifically, and I believe the ofFbo also has some flipping specific code.
ofEnableNormalizedTexCoords() has no effect in the new programmable Renderer. It should be deprecated. If the users wants to uses normalized tex coords he should say ofDisableArbTex(), and use sampler2D in GLSL. If he wants to use ARB tex coordinates he should say ofEnableArbTex(), and use sampler2DRect in GLSL.
I believe the problem is the way openframeworks loads images. Also openframeworks seems to draw fbos flipped.
For ofImage there is a function called mirror which allows you to flip Images. But Fbos have no such option
The “problem” is actually a design decision by the developers to have texture coords start in the top left, and increase towards the bottom right. Fbos are flipped as well in order to keep them consistent with textures.
I highly recommend using ofDisableArbTex() to switch back to normalized texcoords.
If you use features such as environment mapping with your textures (in a shader), normalized coordinates are much easier to work with. If you’re using the fixed pipeline, some of it relies upon normalized coords.