Screenshot with Transparency

Started by n4pgamer, January 30, 2012, 18:31:39

Previous topic - Next topic

n4pgamer

Hello.

Does someone know if it is actually possible to take screen shots in OpenGL with transparency ? So where I didn't draw any pixels I want alpha being lower than 255.
Now GL11.glReadPixels(0, 0, w, h, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); puts pixel data with alpha to full 255 (-1 in java byte) into my buffer.

I have the following settings that might have to do something with this problem:
GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glClearColor(0, 0, 0, 0);


Also I draw 32-bit textures which are smoothed not pixelated.

Does someone know where to look or what to do ?

Cheers!

When I set GL11.glClearColor(0, 1, 0, 0); I get a green background. That means the alpha values in the buffer are set to 255 by default and it doesn't get "cleared" at all right ?
Is it possible to write alpha values to the buffer or create an off-screen-buffer and copy the pixels to the current draw-buffer ?