displaying .bmp files

I am trying to write a simple program that displays .bmp images in a window. Does anyone have any or know where I could find any sample code for an application like this?

By the way, I have been trying to use the glDrawPixels command. Is this the best command to use for what I am trying to do?

only use glDrawPixels if you don’t care about speed. Otherwise you should draw a textured quad.

Hi jgrashow - if you’re writing the app for OpenGL try using the glaux library. The function auxDIBImageLoad loads a BMP up for you. You can then use the data it returns to create a GL texture. Go see http://nehe.gamedev.net/opengl.asp and take a look at the texture mapping demo - Lots of good GL code examples here.

I wouldn’t recommend using the aux libraries, they are obolete and buggy.

The best texture lib I’ve found is glPNG http://www.wyatt100.freeserve.co.uk/download.htm
It will do the dirty work for you, but it’ll also just load a file and give you the raw data if you want. And .png is a VERY flexible format…