Loading BMPs for Texture Mapping


When I want to use 2D texture mapping, the “problem” arises that I have to load BMP files.
Although I read a source code which showed how to load and store BMP information into the appropriate structures, it was written in C-Style code. ( I use to load files via the iostream classes…)
Apart from that, I don’t know anything about Windows BMP, thus I couldn’t understand the source code.

Could anybody give me a simple example which demonstrates only the really necessary things about how to load a bitmap and attach it to the glTexImage function?

I dont know what your programming capabilities are but to most beginers i would say go to the NeHe site.

There are a range of tutorials on this site including loading and creating texture maps from BMP files.

hope that helps


If you don’t want to load a bmp with glaux (like in NeHe’s tutorials) I coded a c++ class that loads bmps. Mail me if you need it (email in profile).
Also you can have a look at www.wotsit.org (or .com??) to find specifications about every file format you need.