Can't get transparency working in lwjgl

Hello everyone.

I’ve tried almost everything to get transparency working in lwjgl but I still can’t do it, could someone tell me the steps I need to follow to accomplish this with out having to use masks?

some of the things I would like to know in specific is:

how should I load my textures? with GL_RGBA? And should I save my files as gif or png? are there any problems with the png format?

what variables should I enable to get transparency displaying correctly?

If this can’t be solved and it’s too much trouble to make masks then maybe I should go back to Java 2D which wouldn’t be too good since I would like fast alpha blending and a good fps…

any help would be greatly apprechiated.

For sprites, usually you’d load images into RGBA textures. The source can be whatever file format you want, but png is nice because it’s RGBA to start with. Rendering just involves setting the texture on a quad with the appropriate texture coords. Then, to get blended edges you’d use glEnable(GL_BLEND) and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA). Obviously you can use other blend modes but thats what you want for most sprite drawing.

Thanks so much for the reply! I’ll see if it gives me the result I want.

Also worth noting that Photoshop 6 & 7 have bugs with their PNG handling that causes them to strip your alpha channel. Photoshop CS reportedly works properly. There is a Photoshop PNG plugin called SuperPNG that you will want if you are exporting PNGs from Photoshop:

http://www.fnordware.com/superpng/