Reputation:
I'm working on a game, and all of my graphics use magenta as transparent/magic color. They are all 32-bit and the magenta is just for conveniency. Anyway, I would appreciate if someone could advice me what library should I use to load my images (I need to load them in GL_RGBA format, both internal and texture specific).
Upvotes: 5
Views: 9296
Reputation: 1
Another option is OpenCV.
It does a lot more than just texture loading, but odds are good you'll find use of its other features as well.
Upvotes: 0
Reputation: 15464
There is a very minimalist one file example of loading a png into openGL here:
http://tfc.duke.free.fr/coding/src/png.c
Upvotes: 1
Reputation: 22591
Apart from the other answers mentioning SDL and DevIL, there are two more options to consider:
Upvotes: 1
Reputation: 157
If only PNG support is necessary, use libpng. DevIL is supposed to be easy, but it's somewhat bloated (does a lot more than just load images) and internally actually calls OpenGL functions which can mess with your own OpenGL logic.
I personally prefer SDL_image, since I'm using SDL in my projects anyway. While not immediately obvious, SDL_BlitSurface() function can do the conversion from whatever IMG_Load() returns to the necessary pixel format.
Upvotes: 6