View Full Version : Programming own image loaders for OpenGL 3.2+

04-18-2013, 03:58 PM
Hey everyone :)

Recently I've started to take a bit more interest in how image loading/decoding is actually done. Especially because at times I want to use frameworks such as LWJGL with OpenGL 3.2+, which as far as I can see, haven't gotten up to speed with supporting utilities within libraries such as SlickUtil that really works with the newer OpenGL versions, but perhaps I'm mistaken.

Anyways it got me curious about the whole process of creating image loaders/decoders such as functions to read in PNG files or JPEG files and then convert them into OpenGL textures etc.

I did some searching around but I really haven't been able to find any resources on how to get started with writing your own image loaders. I'm thinking it could be a great learning experience.

Is there anyone who have any tips on what resources would be good to read and learn in order to get started with this business?

Thank you all for your time :)

carsten neumann
04-18-2013, 08:51 PM
Hmm, how does the OpenGL version affect the image loader library you use? - I usually consider uploading textures to OpenGL a two step process: first you use an image loader library to get the data into main memory and second use your favorite graphics library (or direct OpenGL calls) to get the data into textures.

For the two formats you mention you only need to go to websites of the canonical loader libraries libpng (www.libpng.org) and libjpeg (http://libjpeg.sourceforge.net/) for information on the file formats and the code to read them.

I don't know the situation for java, but for c/c++ there are dozens of image loading libraries, so the design space for these things seems fairly well explored...