Page 1 of 1

openGL png images are upside down

Posted: Thu Oct 20, 2005 02:53
by gcarlton
Currently when using devil and opengl, I found that png images are upside down!

Looks like CEGUI is flipping loaded textures from devil, which must be done sometimes, rather than always. For example, tga looks like it needs the flip, but png apparently does not. The following fix, taken from here, seems to work:

http://sourceforge.net/forum/forum.php? ... m_id=13560

Old code in OpenGLTexture::loadFromFile:

Code: Select all

      // flip the image
      iluFlipImage();


New code in OpenGLTexture::loadFromFile:

Code: Select all

      // flip the image
      int origin = ilGetInteger(IL_IMAGE_ORIGIN);
      if (origin == IL_ORIGIN_LOWER_LEFT)
      {
         iluFlipImage();
      }    


I'm surprised this issue hasn't come up before.. Or is everybody else using a different (non-broken) version of devil? :roll: