RGBA Images in OpenGL

Could someone please tell me a fileformat that supports RGBA, and how to implent it into a image!
And yes I have photoshop…

[This message has been edited by Brorsson (edited 04-04-2001).]

We use targa (.TGA) files and several of the demos in the Rage128 and RADEON SDKs have code for loading this into textures. Specifically, look for the ATI_GLTexture class in the shared source and includes download from this page .


[This message has been edited by JasonM [ATI] (edited 04-04-2001).]

And how do I make a specific color or spectrum, to be transparent in the tga file?

I thought you said you had Photoshop :wink:
On the little Layers/Channels/Paths widget, go to the Channels tab and make a new channel (for a total of four). Make the new channel by clicking on the little “Create new channel” button at the bottom of the widget. That fourth channel is your alpha channel. How you populate it with data is an art question. For most things that I do, I end up grabbing the contents of one of the other channels and pasting it in there. A few manipulations later, you’ll have the alpha channel you want.


The problem was that i didn’t know that the alpha channel was included that easy into a tga file:-)

But now one other problem has occured :-P!!!
I’ve found code for reading a tga file and convert it into a texture. (one cpp file "tgaload.cpp, and one header, tgaload.h)
I’ve read through these files over and over, and can’t find any errors, but Visual Studio 6.0 :-), complains like hell when I’m trying to compile the stuff!
Are there any other files out there I could borrow :slight_smile:
This stuff makes me go crazy!


ack, the scurge of getting third party code to compile. I know that all too well. =) What kind of errors are you getting? I mean, if its just something like… oh, I don’t know… linker errors not finding malloc, for example, then the solution is relatively simple. I mean, it MIGHT be easy to fix.

In the meantime, however, you could check out

which has tonnes of image file formats. Admitedly you’d need to code your own reader… but you can cheat and only write the bits you need. (For example, you can only target one PARTICULAR subformat of the file format spec, like only support uncompressed true-colour TGA files, for instance).

hope this helps,


Did you try the class implemented in GLTexture.cpp and GLTexture.h I suggested above? It doesn’t handle all variants of TGA files, but it’ll handle the 32 or 24 bit ones you’ll save from PhotoShop and is easy to add to your own project. The code downloads from this page should do what you need.