diff options
author | Sven Gothel <[email protected]> | 2012-07-20 14:08:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-07-20 14:08:49 +0200 |
commit | 4a08de4511a627c3d87d6a33debbd561962c0312 (patch) | |
tree | 68576036b13d49ddb73855444bbb1a0fb25ba54b /src/jogl/classes/jogamp/opengl/egl | |
parent | 2da0d69fec6209c55832f5aae9d365e25d3aba6d (diff) |
GLCapabilities Native Aquisition: Set alpha bits at last - due to it's auto setting by setSampleBuffers(true) and setBackgroundOpaque(false)
This bug lead to X11 GLCapabilities rgba: 8/8/8/1 - which ofc is invalid. Sideeffect was a bad selected GLXFB configuration
and the GLContext couldn't be made current.
Patch sets alpha bits reflecting reality carefully after opaque/samples. Added API doc note.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java | 37 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java | 8 |
2 files changed, 23 insertions, 22 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 214b36493..73867fb40 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -209,24 +209,6 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return false; } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val)) { - caps.setRedBits(val.get(0)); - } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val)) { - caps.setGreenBits(val.get(0)); - } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val)) { - caps.setBlueBits(val.get(0)); - } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val)) { - caps.setAlphaBits(val.get(0)); - } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val)) { - caps.setStencilBits(val.get(0)); - } - if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val)) { - caps.setDepthBits(val.get(0)); - } if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_SAMPLES, val)) { caps.setSampleBuffers(val.get(0)>0?true:false); caps.setNumSamples(val.get(0)); @@ -262,6 +244,25 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0)); } */ } + // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples) + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val)) { + caps.setRedBits(val.get(0)); + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val)) { + caps.setGreenBits(val.get(0)); + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val)) { + caps.setBlueBits(val.get(0)); + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val)) { + caps.setAlphaBits(val.get(0)); + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val)) { + caps.setStencilBits(val.get(0)); + } + if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val)) { + caps.setDepthBits(val.get(0)); + } return GLGraphicsConfigurationUtil.addGLCapabilitiesPermutations(capsBucket, caps, drawableTypeBits ); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 6be9cb547..d79c351a0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -253,12 +253,12 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact // // rgb888 - d16, s4 final GLCapabilities fixedCaps = new GLCapabilities(glp); + fixedCaps.setSampleBuffers(true); + fixedCaps.setNumSamples(4); fixedCaps.setRedBits(8); fixedCaps.setGreenBits(8); fixedCaps.setBlueBits(8); fixedCaps.setDepthBits(16); - fixedCaps.setSampleBuffers(true); - fixedCaps.setNumSamples(4); if( !capsChosen.isOnscreen() ) { fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); @@ -291,12 +291,12 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact // // rgb565 - d16, s4 final GLCapabilities fixedCaps = new GLCapabilities(glp); + fixedCaps.setSampleBuffers(true); + fixedCaps.setNumSamples(4); fixedCaps.setRedBits(5); fixedCaps.setGreenBits(6); fixedCaps.setBlueBits(5); fixedCaps.setDepthBits(16); - fixedCaps.setSampleBuffers(true); - fixedCaps.setNumSamples(4); if( !capsChosen.isOnscreen() ) { fixedCaps.setOnscreen(false); fixedCaps.setPBuffer(capsChosen.isPBuffer()); |