Texture Loading

Started by
3 comments, last by mmakrzem 16 years, 1 month ago
Hi all. I'm new to GameDev.net. I'm learning OpenGL and I can already do lots of things with it. Fog effects, lighting, 3D transformation etc. But now I've a problem. I don't know how to load a texture in OpenGL. I searched with goggle and in NeHe's page. But I didn't understand anything. In reality, the problems are two: 1) I don't know any Image file format such as BMP, TGA, PNG etc; 2) I don't know how to use the image as a texture. could someone help? THANKS
Advertisement
You couldn't find anything on NeHe?

"Lesson 6: Texture Mapping"
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06

"Lesson 33: loading compressed and uncompressed TGAs"
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=33

The code done by NeHe should be enough to get you started but remember that OpenGL doesn't use TGA, BMP, JPG or any image file type directly. This is because a texture is just a block of memory filled with data that's been organsied in a particular manner. So most of the image loaders that you use just read from the image files format and place it directly into their own internal, possibly opengl friendly, representation.

Hope those help.

Andy

"Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile"

"Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgement difficult."

Yes. It helped a lot. Know I understand all those functions such as glTextureParameteri();

THANK YOU.

Good Bye
You could use SDL combined with Opengl. SDL_image support a lot of textures.
•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜˜”*°•..•°*”˜˜”*°•.˜”*°•.˜”*°•. Mads .•°*”˜.•°*”˜.•°*”˜˜”*°•.˜”*°•..•°*”˜.•°*”˜.•°*”˜ ˜”*°•.˜”*°•.˜”*°•..•°*”˜I am going to live forever... or die trying!
On my website I have a video tutorial that explains loading a TGA file into memory and displaying it using OpenGL.

This topic is closed to new replies.

Advertisement