View Full Version : Image Loading backwards....Please help

05-29-2008, 11:03 AM
I am fairly new to OpenGL and am currently loading an image onto a polygon. The image is a lizard tech format (MrSID), which isn't the issue at this point. My issue is that I am able to load the image but it is backwards, or I guess I could say it looks like I am looking at the image from the opposite side. any suggestions on how to fix this problem?

05-29-2008, 11:21 AM
I am looking at the image from the opposite side

What do you mean here, I don't understand...is it about texture mapping coordinates?

05-29-2008, 11:31 AM
Yes, it is texture mapping coordinates. I believe it is the pixels that are loading incorrectly. So the pixel that should be at my (0,0) is loading to the opposite side. Lets just call it (1,0) for now.

05-30-2008, 10:00 AM
Any ideas yet?

05-30-2008, 11:35 AM
(x = 0, y = 0) is the bottom left and (1, 1) is the top right corner in the OpenGL coordinate system. The first pixel you load is assigned the coordinate (0, 0). Each row gets an increasing y coordinate and the final pixel will have the coordinate (1, 1).

I suppose your image is flipped upside down since when you load your images you get the image data stored from top to bottom while OpenGL expects it from bottom to top (like .tga files normally store them).

You will have to either flip the images horizontally or adjust your texture coordinates on the fly.

[ www.trenki.net (http://www.trenki.net) | vector_math (3d math library) (http://www.trenki.net/content/view/16/36/) | software renderer (http://www.trenki.net/content/view/18/38/) ]

06-02-2008, 06:05 AM
Actually it is loading right side up, it is just facing the wrong way. What should be the right side is on the left...