Cory Buckley
Cory Buckley

Reputation: 71

Fastest Simplest way to use PNG textures in OpenGL

I am looking for the fastest and easiest way to use PNG (with alpha values) textures in OpenGL. I have tried many different libraries but most are bloated and hard to get compiled/working on a Mac.

I'm not very familiar with OpenGL textures and all of the "Gotchas" so I am putting emphasis on the Simple.

It would be very helpful if someone could give me a nice makefile example if the solution involves linking a library.

Thanks!

Upvotes: 2

Views: 1217

Answers (4)

genpfault
genpfault

Reputation: 52084

You might give SOIL a whirl.

Upvotes: 3

ssube
ssube

Reputation: 48257

DevIL can do this pretty simply and easily, for quite a few formats. It also have a very, very similar API to OpenGL (by design, most constants are identical, etc). It took me just a few minutes to hook it into an OpenGL app I had. The docs aren't great, but it does the job and supports a lot of formats.

Upvotes: 1

ypnos
ypnos

Reputation: 52337

sdl and sdl_image is the simplest way I know of: http://www.libsdl.org/ http://www.libsdl.org/projects/SDL_image/

However, this is for cross-platform. For Mac-only I guess there is a native alternative.

Upvotes: 1

Dan D.
Dan D.

Reputation: 74645

glpng is a png opengl loader utility library although one can do what it does with just libpng and gl it loads from a png file into a texture for you in one call

Upvotes: 0

Related Questions