OpenGL and Images (looking for a lead)

Hello folks. Anyone know of a nice tutorial that shows you how to load and then draw an image file?

I’m thinking along the lines of “here’s how to load your *.bmp *.jpg *.png *.rgb file. Now here’s how to draw that picture info with OpenGL.”

I’d appreciate any leads. Thanks
-Lagaidh Smif

You have
http://www.gametutorials.com/

You also have my site
http://cheo.resnet.wayne.edu/miguel/

Thanks Mancha! I’m gonna hit those sites now and have a look.

Those sites aren’t quite what I am looking for, but I appreciate your posting.

Anyone else have an idea?

Those sites likely have what you need, but you don’t know quite what to look for.

For loading image types, you basically have a couple of options.

  1. Use a third party library.
  2. Learn the file format and write your own loader. (www.wotsit.org has many different file format specifications.)

Basically, whether you use 1 or 2, you want to get the image data into a standard format. Typically the most common is unsigned bytes of RGB or RGBA data. (Or BGR, BGRA.) Basically, in this format each byte represents the R, G, B, or A data for a single pixel. (So if you have RGB data the first pixel is R= data[0] G = data[1] B = data[2])

Once you have that data, you have 2 options for displaying it.

  1. Load it as a texture and display a textured quad. (Image must have dimensions that are a power of 2 for this to work, so resizing may be required.)

  2. Use glDrawPixels.

Hope that helps

[This message has been edited by Deiussum (edited 04-11-2003).]

I would like to add nehe.gamedev.net

But maybe if you give a little more detail as to what you are trying to do?

Load a image to the screen?
Load a image and edit it?
???

Originally posted by Lagaidh:
[b]Hello folks. Anyone know of a nice tutorial that shows you how to load and then draw an image file?

I’m thinking along the lines of “here’s how to load your *.bmp *.jpg *.png *.rgb file. Now here’s how to draw that picture info with OpenGL.”

I’d appreciate any leads. Thanks
-Lagaidh Smif[/b]