View Full Version : JPG Loader for OpenGL
06-23-2010, 10:14 PM
I have just started programming with OpenGL and wanted to know the procedure for loading a JPG file which will subsequently be used as a texture in OpenGL. Will I have to use an external file loader or if OpenGL has an in-built function for this purpose?
Thanks in advance
06-24-2010, 03:10 AM
You can use libjpeg or if you want to manage several image formats and have support for transformations like flip, rotation, color space transformation like BGR to RGBA and so on you can use OpenCV.
Once you have the raw pixel matrix in memory you can use it as a texture.
06-24-2010, 03:23 PM
Try DevIL: http://openil.sourceforge.net/
06-25-2010, 09:54 AM
There's a lighter alternative for JPEG:
06-28-2010, 07:57 AM
Check out the quake3 source code. They have a simple loader (I grabbed the tiff version, but haven't converted the jpg one yet)...
06-28-2010, 02:09 PM
Depends on your environment. If you're on Windows GDI+ can load a JPEG and give you direct access to the pixels for uploading as a texture, and has the nice bonus that it's not dependent on external libraries. If not, or if portability is a concern, grab one of the other alternatives already mentioned.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.