OpenGL Image Textures

Yes, compression is where the argument is. Why use TGA when libpng is so easy to use? PNG supports alpha and compresses far better than TGA and is lossless too, not to mention cross-platform compatible. I've never had any problems with load time so I've never bothered to compare. I just don't see any arguments in favor of using TGA over PNG.

With TGA or PPM, you can avoid dependency of libpng and have the whole loader at your fingertips. That is a good backdoor any time you find yourself on a platform without libpng, and simplifies the setup while learning (definitely an advantage in CG teaching). Any time a student has an unusual setup, you get strange questions about why they can't fine libjpeg and libpng. They are good, but often require extra work. It is no problem for my own programming, but as a teacher, TGA makes life easier.

There are always other ways to see things, other needs. I don't in any way argue against PNG, sure it is more advanced and theerfore gives better compression, I only say that it may not be the shortest route to that first running version of your first game.

I can't put it after all my #includes, as C can't create variables based on function calls inside functions. If I put it in main() when I draw the plane in drawScene() It won't recognise it, as it's not global. If I put it in drawScene() It doesn't recognise SOIL_load_OGL_texture.

That's correct. Well, actually, maybe. Xcode might know to look in the same path as you used for SOIL.h now that I think of it. I always drag the ones I need anyway so that I can refer to them, so I don't recall ever testing that...

I can't put it after all my #includes, as C can't create variables based on function calls inside functions. If I put it in main() when I draw the plane in drawScene() It won't recognise it, as it's not global. If I put it in drawScene() It doesn't recognise SOIL_load_OGL_texture.

... whole bunch of problems here. backslash covered part of it. The trickier issue for you is going to be the part where it doesn't recognize SOIL_load_OGL_texture. That suggests to me that you're still using the lib that came compiled with SOIL. That lib doesn't work on OS X, so you'll have to compile a new one:

In the SOIL folder, where you'll see some test images and a lib and src folder and some others, make a new folder named obj. Then navigate to projects/makefile. In there should be the makefile. You'll need to make a slight modification to it, so open it in TextEdit (or whatever), and modify the line that says:

OBJDIR = obj

so that it says:

OBJDIR = ../../obj

and save it.

Then launch Terminal. In Terminal, type cd, then drag the makefile directory onto Terminal and hit return. To make sure you're in the right directory, if you type ls and return you should get "alternate Makefile.txt makefile". Then type make and return and it'll do some compiling. The new Mac compatible lib should now be in the lib directory.

Isn't Mikey's problems exactly what I talked about? Adding a small C file for loading a texture sounds a bit easier to me.

This brings me to a related question: When using libraries like libjpeg, libpng and libz, there are several different ways to install and use it.

- Unix-style installation, static link. I would consider this default. I also consider Unix-style installers rather scary.
- Local library copy, static link. Easiest?
- Install as Framework. There are framework versions of both libjpeg and libpng. The framework can be either global or inside the app bundle.

One may say "they all work", and I guess they do, but what do you prefer, and why? Also, what is best for the inexperienced user, what gives the least number of nasty pitfalls?