Sign in to follow this  
MariusProgrammer

OpenGL Texture Loading

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
On my website I have a video tutorial that explains loading a TGA file into memory and displaying it using OpenGL.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this