Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Is the origin of an image in the bottom left corner in OpenGL?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    Johannesburg, South Africa
    Posts
    28

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Is the origin of an image in the bottom left corner in OpenGL?

    The origin is in the lower left corner.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Location
    Johannesburg, South Africa
    Posts
    28

    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
  •