pbuffer transparency

Hi,

I am using a GLJPanel, which works well with transparency, when java 1.6 ‘JOGL/Java2D integration enabled’. However, the fallback is pbuffer, transparency does not work. Any ideas what could cause this ?

I have

GLCapabilities glcaps = new GLCapabilities();
glcaps.setAlphaBits(8);
glcaps.setRedBits(8);
glcaps.setBlueBits(8);
glcaps.setGreenBits(8);
glcaps.setStencilBits(0);
glpanel = new GLJPanel(glcaps, null, shareContext);
glpanel.setOpaque(false);
glpanel.addGLEventListener(gle);

Another problem with pbuffer is transparency, when using public static BufferedImage readToBufferedImage(int width, int height, boolean alpha). It does not provide a transparent image.

If I copy the code and replace readbackType from GL.GL_ABGR_EXT tp GL.GL_BGRA. transparency works, but I get some ugly colours.

Regards Christian

What graphics card do you have? Do you have a test case? Transparency support should actually currently be more correct with the pbuffer backend for the GLJPanel rather than when the Java2D / OpenGL pipeline is enabled.

Hi,
Thanks for the response.

I have found that


if(!(gld instanceof GLJPanel && ((GLJPanel)gld).shouldPreserveColorBufferIfTranslucent())) {
    		gl.glClear(GL.GL_COLOR_BUFFER_BIT);
   	}

did the trick to my first problem (this was rather confusing, because clearing the buffer using the Panel, causes the panel to not being transparent)

To the second problem I have tried swapping two of the bytes throughout the image, and gets transparency, but of course wrong colours.

Regards Christian