OpenGL ES has different UV coordinates?
I am using OpenGL ES 1.1 with texture mapping. I've always thought that the UV coordinate system for textures starts at the top-left corner and goes right-right. This is good on Android, I tested it. However, if I test it with Qt on the desktop, my UV coordinate system starts at the bottom-left corner and goes up-right. This is normal? I am using the same code to install OpenGL
glViewport(0, 0, m_screenWidth, m_screenHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef DESKTOP_QT
glOrtho(0, 1, 0, 1, -1, 1);
#else
glOrthof(0, 1, 0, 1, -1, 1);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Also wondering why glOrthof is not supported by Qt and glOrtho is not supported by Android? Is there a feature that is common to both frameworks?
source to share
In OpenGL, the default texture coordinate (0,0) corresponds to the bottom left corner of the texture. It has always been (and probably always will be) this way since OpenGL exists.
However, you can change this convention by changing the texture matrix or simply keeping the texture flipped upside down.
And by the way, glOrtho
it has nothing to do with Qt or Android, this is an OpenGL feature. So you are probably not experiencing the difference between Qt and Android, but between desktop OpenGL and OpenGL ES. However, texture coordinates should start at the bottom left in both versions.
source to share