PDA

View Full Version : how to view a background Image (.jpg or gif)



oq8
10-08-2003, 06:15 AM
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 )) http://www.opengl.org/discussion_boards/ubb/smile.gif

bumby
10-08-2003, 06:34 AM
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 (http://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).]

10-09-2003, 03:06 AM
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

oq8
10-12-2003, 03:28 AM
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... :)

Leyder Dylan
10-12-2003, 11:46 AM
I've a simple demo who display a texture as splash screen.

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