Texture mapping

I am trying to texture map, but is there any way to import a bitmap file to the scene?

Originally posted by Mathur:
I am trying to texture map, but is there any way to import a bitmap file to the scene?

OpenGL does not provide any file loading routines. So you have to take care yourself of getting your file loaded. For many languages you can find bitmap loading libs either as part of a development package or on the net.

If you want to do things yourself(and it might be a good idea if your starting out) get the specs from a format(like targa tga) and write a loader(which isn’t hard to do).Otherwise have a look at the DevIL library.

Or, if you just want to work with code that’s already written to load TGA files, I recommend NeHe’s tutorials. His page is at http://nehe.gamedev.net
(I’m pretty sure that’s it… it’s down right now so I’m not positive. You can always just google it (nehe and opengl) and it comes up first.
Anyway, under his opengl tutorials, up in the teens he’s got one on loading TGAs and it’s not too much code.

just be careful because last time I checked there wasn’t any code to handle the image origin mechanism so some tgas might get loaded reversed.Depends on the program that saved the tga(it was the case with gimp for instance).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.