how to view a background Image (.jpg or gif)

Hi…

I am a new opengl user… I am tring to figure out how to view a background image such as .jpg or .gif into the main window that we are creating…

Is there a uniqe command to do that ?
or should we just use the old AUX library ??
I found a DevIL package but it WAS too complicated… is there a DIRECT command to load such thing ?

Thank you in advance…

(( I am a student at ODU, VA … and this is NOT a homework question ))

There is no direct command to load a jpg or gif.

You need a file loader. I have never used Devil, but I am sure it has loaders for these file types. It has some pretty good documentation and tutorials…so if you read those, it might not be as complicated as it seems.

You could write your own file loader…you can get the file format specs from the net… www.wotsit.org …look under the graphics files button.

Once you have the image loaded, you can use the array of bytes (or whatever) as a texture, or write them directly to the buffer (using glDrawPixels). the texture way is faster.

[This message has been edited by bumby (edited 10-08-2003).]

I have written a function that can load a 24-bit BMP file and put it in a texture object. If you need the function then mail me.

mehedi_b@yahoo.com

Well… thanks to both of you…

I tried to view ANY background (such as .ppm or .RGB ) instead of those jpeg or GIF… but i am still confused… !! :((

Is there a (small) code to view a .ppm or a .ras image ?

((( i used an opengl book to view the .ppm but every image is different to be viewed… :()))))

thanks again… :slight_smile:

I’ve a simple demo who display a texture as splash screen.

http://www.slug-production.be.tf/