aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-25 05:47:29 +0200
committerSven Gothel <[email protected]>2012-03-25 05:47:29 +0200
commita0abff2c5ea6adee2813bf49141b2a106f055390 (patch)
tree6d92b800af673fbc001ef6ff891fd69e4c7de245 /src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
parent2357728a8b1ed2edd961b94e75ebddfe12e4516f (diff)
Fix EGLConfig re-use w/ different EGLDisplay handle (Triggered w/ Mesa EGL/ES)
Reusing the native EGLConfig handle of another EGLDisplay is invalid, hence the EGLCapabilities cfg-handle value shall be 'refreshed' using the immutable cfg-id and the new EGLDisplay. Also fix EGLError value in createSurface() exception and don't override EGLCapabilities transparency value for a given EGLConfig ID.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 35e30c5f4..9f9a7b9c4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -73,19 +73,20 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
}
public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int cfgID) {
- AbstractGraphicsDevice absDevice = absScreen.getDevice();
+ final AbstractGraphicsDevice absDevice = absScreen.getDevice();
if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
}
- long dpy = absDevice.getHandle();
+ final long dpy = absDevice.getHandle();
if (dpy == EGL.EGL_NO_DISPLAY) {
throw new GLException("Invalid EGL display: "+absDevice);
}
- GLProfile glp = capsRequested.getGLProfile();
- long cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
- EGLGLCapabilities caps = EGLConfig2Capabilities(glp, dpy, cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
- caps = (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(caps, capsRequested.isBackgroundOpaque()); // FIXME: valid to override EGL transparency ?
- return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser());
+ final long cfg = EGLConfigId2EGLConfig(dpy, cfgID);
+ if(0 < cfg) {
+ final EGLGLCapabilities caps = EGLConfig2Capabilities(capsRequested.getGLProfile(), dpy, cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
+ return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser());
+ }
+ return null;
}
@Override
@@ -106,7 +107,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
}
}
- public static long EGLConfigId2EGLConfig(GLProfile glp, long display, int configID) {
+ public static long EGLConfigId2EGLConfig(long display, int configID) {
int[] attrs = new int[] {
EGL.EGL_CONFIG_ID, configID,
EGL.EGL_NONE
@@ -365,7 +366,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
@Override
public String toString() {
- return getClass().getSimpleName()+"["+getScreen()+", eglConfigID "+toHexString(getNativeConfigID())+
+ return getClass().getSimpleName()+"["+getScreen()+
+ ",\n\teglConfigHandle "+toHexString(getNativeConfig())+", eglConfigID "+toHexString(getNativeConfigID())+
",\n\trequested " + getRequestedCapabilities()+
",\n\tchosen " + getChosenCapabilities()+
"]";