Loading an image

Hi there,
For a project, I need to load an image (png, jpeg, doesn’t really matter) and display it in my window. Then I need to make it move across the screen, etc.

What library will be best for loading the image? I’ve looked into freeimage, but I couldn’t figure out how to display the image once it was loaded.

Thanks.

To load and use a 2D texture in opengl you need to:

  1. Load image data into system memory
  2. Generate a texture name with glGenTextures
  3. Bind the texture name with gBindTexture
  4. Set wrapping and filtering mode with glTexParameter
  5. call glTexImage2D with the right parameters depending on the image nature to load image data into video memory

Finally just bind the texture before drawing it onto a quad.

Look at opengl man pages for more information about all these functions.

You can also look at the opengl wiki page and here for texture mapping.

try this one i made for nehe.gamedev.net