Main Menu

tga loading

Started by bisquit, May 24, 2007, 02:37:48

Previous topic - Next topic

bisquit

hi! i'm trying to imitate lesson32 from nehe.gamedev.org and i noticed that they're using tga files... how can i use tga files without the black background showing? and how can i create my own tga files?

not really familiar with it.

i tried copying 'loadTextures(string path)' from the lesson, but it just gave me an error on Display.update(). which i don't get at all.

thanks for your helP!

bobjob

assuming that the file loads.

if its only a problem with transperancy

add this in ur code: when setting up openGL

GL11.glAlphaFunc(GL11.GL_GREATER,0.1f);
GL11.glEnable(GL11.GL_ALPHA_TEST);

bisquit

thanks! now it works for .tga files..

but now, how can i make my own tga files? i've tried making it in photoshop with a transparent background.. but the background becomes white when i load it...

bobjob

im not sure about photoshop.
I use Gimp its free :)

make a new transperant layer then delete the background, so that the transperant layer is the background.
then place your image on top.

oNyx

If you have a bunch of PNGs it's easier to convert em via imagemagick like:

mogrify -format tga *.png

If you want to create a 32bit tga in photoshop, you'll need to add an alpha channel in the channels tab (with that new channel button). If you want to use the existing alpha from the RGB stuff (well... photoshop is a bit weird in that regard) you can do it like:
-ctrl+click on the layer
-go to the channels tab
-hit new channel
-select white
-alt+backspace

And then you got some sparkling new alpha channel, which matches your usual alpha stuff.