Jump to content
  • Advertisement
Sign in to follow this  
MariusProgrammer

OpenGL Texture Loading

This topic is 3764 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!