-
Is the origin of an image in the bottom left corner in OpenGL?
I have just added texture mapping to my app but when I map a texture it comes out upside down and I have to swap the ST co-ordinates to flip it the right way up.
The origin of my texture is top left and it is loaded into memory in that format. I verified that by doing a binary dump into a file and examining the contents with a hex editor after nearly pulling my hair out. 
Now all the OpenGL tutorials I have come across map a quad like this :
glBegin (GL_QUADS);
glTexCoord2f (0.0, 0.0);
glVertex3f (0.0, 0.0, 0.0); // Bottom left
glTexCoord2f (1.0, 0.0);
glVertex3f (10.0, 0.0, 0.0); // Bottom right
glTexCoord2f (1.0, 1.0);
glVertex3f (10.0, 10.0, 0.0); // Top right
glTexCoord2f (0.0, 1.0);
glVertex3f (0.0, 10.0, 0.0); // Top left
glEnd ();
When working with ST co-ordinates does (0,0) mean the bottom left corner in MEMORY or the top left corner in MEMORY?
According to me it means the top left corner in memory which means that all images should be loaded into OpenGL upside down, correct?
Thanks
Paul
-
Senior Member
OpenGL Guru
Re: Is the origin of an image in the bottom left corner in OpenGL?
The origin is in the lower left corner.
-
Re: Is the origin of an image in the bottom left corner in OpenGL?
Hmmm ... ok I'll just swap my ST co-ords since I like to work with my images right way up. 
Thanks
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules