From 2f12b219988dd28b1b2c191afc94b7704022a84a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 3 Sep 2011 02:34:59 +0200 Subject: JOGL/X11GLXGraphicsConfiguration: Query opaque/transparent by XRender 'alphaMask' cfg --- .../jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/jogamp/opengl') diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index 575106555..fd2048552 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -252,6 +252,14 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return null; } + static boolean GLXFBConfigHasAlphaMask(long dpy, long fbcfg, long visual) { + XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); + if(null == renderPictFmt) { + return false; + } + return renderPictFmt.getDirect().getAlphaMask() > 0 ; + } + static boolean GLXFBConfig2GLCapabilities(ArrayList capsBucket, GLProfile glp, long display, long fbcfg, int winattrmask, boolean isMultisampleAvailable) { @@ -298,6 +306,9 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem res.setSampleBuffers(glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLE_BUFFERS, tmp, 0) != 0); res.setNumSamples (glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLES, tmp, 0)); } + + res.setBackgroundOpaque( (null == visualInfo ) ? true : !GLXFBConfigHasAlphaMask(display, fbcfg, visualInfo.getVisual()) ); + /*** res.setBackgroundOpaque(glXGetFBConfig(display, fbcfg, GLX.GLX_TRANSPARENT_TYPE, tmp, 0) == GLX.GLX_NONE); if(!res.isBackgroundOpaque()) { glXGetFBConfig(display, fbcfg, GLX.GLX_TRANSPARENT_RED_VALUE, tmp, 0); @@ -311,7 +322,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem glXGetFBConfig(display, fbcfg, GLX.GLX_TRANSPARENT_ALPHA_VALUE, tmp, 0); res.setTransparentAlphaValue(tmp[0]==GLX.GLX_DONT_CARE?-1:tmp[0]); - } + } */ try { res.setPbufferFloatingPointBuffers(glXGetFBConfig(display, fbcfg, GLXExt.GLX_FLOAT_COMPONENTS_NV, tmp, 0) != GL.GL_FALSE); } catch (Exception e) {} -- cgit v1.2.3