Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vijaykiran

OpenGL texture mapping using jpegs in opengl

This topic is 5723 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

I have been working in opengl for a while and hit this texture mapping subject. I understood that texture mapping could be done only using file formats like raw or ppm. I was wondering if texture mapping can be done using jpegs. If so, could any one take a few minutes and post a simple code that does this job? I would very much appreciate the effort, but that help makes me come out of lots of troubles. Thanks very much, Vijay.

Share this post


Link to post
Share on other sites
Advertisement
u feed OpenGL with raw data,
how u get the data is not OpenGL business,
it dont care, u can read from whatever file format u like,
if u want to write some code to read jpg, there should be a lot of tutorials on web,
or u can use DevIL, it supports a lot of file formats
http://openil.sourceforge.net/

Share this post


Link to post
Share on other sites
OpenGL is independant of any file format used to store your texture. Using a JPG will requier that you convert the image data from the compressed JPEG format to one of the formats that can be read by glTexImage2D() such as GL_RGBA8 or GL_RGB8 etc.


PsuedoCode:

Load Image from file into memory;
Convert image file format to GL readable format;
Call glTexImage2D with converted image data;

Share this post


Link to post
Share on other sites
also opengl suppurts compressed textures check out texture_compression (part of opengl1.3 or 1.4)
as iwaskia saiz using devil is prolly the best bet (it supports most file formats and is easy to use) adding your own jpeg reading code is a major undertaking

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!