PDA

View Full Version : RGBA Images in OpenGL



Brorsson
04-03-2001, 09:49 PM
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).]

JasonM [ATI]
04-03-2001, 10:09 PM
We use targa (.TGA) files and several of the demos in the Rage128 and RADEON SDKs (http://www.ati.com/na/pages/resource_centre/dev_rel/devrel.html) have code for loading this into textures. Specifically, look for the ATI_GLTexture class in the shared source and includes download from this page (http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/rage128sdk/OpenGL/Samples/Rage128Specular.html) .

-Jason


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

Brorsson
04-03-2001, 11:59 PM
And how do I make a specific color or spectrum, to be transparent in the tga file?

JasonM [ATI]
04-04-2001, 06:01 AM
I thought you said you had Photoshop ;-)
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.

-Jason

Brorsson
04-04-2001, 09:47 PM
Thanks!
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 :-)
This stuff makes me go crazy!

john
04-04-2001, 11:18 PM
Howdy,

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
http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html

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,

cheers,
John

JasonM [ATI]
04-06-2001, 02:56 PM
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 (http://www.ati.com/na/pages/resource_centre/dev_rel/sdk/rage128sdk/OpenGL/Samples/Rage128Specular.html) should do what you need.

-Jason