PDA

View Full Version : A very VERY noobish question



DrEams
02-03-2009, 06:52 AM
How to I draw images that are not simple pixel rectangles, like JPG, GIF, PNG, etc. ?

_NK47
02-03-2009, 07:24 AM
with alpha blending. http://www.codesampler.com

DrEams
02-03-2009, 07:43 AM
I'm not talking about alpha...for example, PNG is a compressed image. Does it need to be uncompressed or something? In other words, what is the difference between this and drawing a BMP file?

ZbuffeR
02-03-2009, 07:53 AM
The only difference is that the file format is more complex.
You always have to feed opengl with raw uncompressed texel data (unless you use DXTC formats).
If this sounds too complex for you, a lot of image loading libs exists for that purpose such as freeimage :
http://freeimage.sourceforge.net/
and devil :
http://openil.sourceforge.net/

RGHP
02-03-2009, 09:50 AM
Yes!
Most of those formats store the image compressed. But with the appropiate libs, you don't have to do it your sefl. Here is an example with freeimage:
http://www.opengl.org/discussion_boards/...3307#Post233307 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=46341&Number=233307#Post233307)
Bye!

_NK47
02-03-2009, 10:35 AM
sorry was way off. distracted by "pixel rectangles". basically you load the image file, read it values and uncompress this compress pixeldata to raw uncompressed memory where you then give them to OpenGL. on the uncompressed level all images are same, lots of pixel values made up of color channels.