PDA

View Full Version : using Quicktime and glDrawPixels


kingofsquirrels
2002.07.28, 10:26 PM
I'm trying to use glDrawPixels() to draw a background in my 2D game. The code I use to load a texture (based on NeHe's TGA loading code) can only load 24 or 32 bit uncompressed TGA files, but an 800x600 uncompressed TGA file takes up a lot of disk space. I was thinking of switching to Quicktime, so I could load more optimal formats (such as PNG), or use 8-bit TGA files or something.

However, because of the way Quicktime loads images, the image data appears backwards and upside down when interpreted by OpenGL. In the past I solved this by changing the texture coordinates of a texture-mapped quad (or by manipulating the texture matrix, which is basically the same thing). As far as I know, no such mechanism exists for doing this using glDrawPixels().

What should I do? Any help is greatly appreciated.

OneSadCookie
2002.07.28, 11:02 PM
If you're using a Graphics Importer, you can tell it to draw the image upside-down into your GWorld (ie right-way-up for OpenGL) by swapping top and bottom in its bounds rectangle.

kingofsquirrels
2002.07.29, 06:47 PM
Thanks!