I have solved the problem of getting a separate image from the alpha channel here:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1080183633;start=0#1
The problem now is that the masking information contained in the mask image is not suitable for OpenGL. The opaque and transparent areas are inverted. Thats why you have to invert the color once more to get it to work with JOGL.
Somewhere on the net I found a nice piece of code which uses BufferedImageOps for the invert operation.
At first the greyscale image (described in the linked post) has to be copied into an RGBA type image and then you can this code to invert its colors:
byte[] invert = new byte[256];
for (int i = 0; i < 256; i++) {
invert[i] = (byte)(255 - i);
}
java.awt.image.BufferedImageOp invertOp = new java.awt.image.LookupOp(new java.awt.image.ByteLookupTable(0, invert), null);
texImage = invertOp.filter(texImage, null);
Now you can use the usual routine to create the OpenGL texture (accessing databuffer, wrapping into a ByteBuffer, glTexParameteri, glGenTexture2D).
Now after all I got this to work but in chapter 9 under ‘Texture Functions’ in the red book it is stated that with GL_DECAL RGBA textures are drawn like insignias. Thats exactly what I wanted. Somehow the transparent areas do not show the colors behind the texture but instead the color which was last set with glColor3/4f …
Any ideas what I am doing wrong?