aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.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/EGLDrawable.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/EGLDrawable.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index b54089d13..6ef016aa4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -90,8 +90,9 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), surface.getSurfaceHandle());
- if (EGL.EGL_NO_SURFACE==eglSurface) {
- final int eglError0 = EGL.eglGetError();
+ int eglError0 = EGL.EGL_SUCCESS;
+ if (EGL.EGL_NO_SURFACE == eglSurface) {
+ eglError0 = EGL.eglGetError();
if(EGL.EGL_BAD_NATIVE_WINDOW == eglError0) {
// Try window handle if available and differs (Windows HDC / HWND).
// ANGLE impl. required HWND on Windows.
@@ -102,12 +103,15 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+eglConfig+", error "+toHexString(eglError0)+", retry w/ windowHandle");
}
eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), nw.getWindowHandle());
+ if (EGL.EGL_NO_SURFACE == eglSurface) {
+ eglError0 = EGL.eglGetError();
+ }
}
}
}
}
- if (EGL.EGL_NO_SURFACE==eglSurface) {
- throw new GLException("Creation of window surface failed: "+eglConfig+", "+surface+", error "+toHexString(EGL.eglGetError()));
+ if (EGL.EGL_NO_SURFACE == eglSurface) {
+ throw new GLException("Creation of window surface failed: "+eglConfig+", "+surface+", error "+toHexString(eglError0));
}
if(DEBUG) {
@@ -176,7 +180,15 @@ public abstract class EGLDrawable extends GLDrawableImpl {
AbstractGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
final GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities();
if(aConfig instanceof EGLGraphicsConfiguration) {
- eglConfig = new EGLGraphicsConfiguration(s, (EGLGLCapabilities)aConfig.getChosenCapabilities(), capsRequested, null);
+ final EGLGLCapabilities capsChosen = (EGLGLCapabilities) aConfig.getChosenCapabilities();
+ if(0 == capsChosen.getEGLConfig()) {
+ // 'refresh' the native EGLConfig handle
+ capsChosen.setEGLConfig(EGLGraphicsConfiguration.EGLConfigId2EGLConfig(eglDisplay, capsChosen.getEGLConfigID()));
+ if(0 == capsChosen.getEGLConfig()) {
+ throw new GLException("Refreshing native EGLConfig handle failed: "+capsChosen+" of "+aConfig);
+ }
+ }
+ eglConfig = new EGLGraphicsConfiguration(s, capsChosen, capsRequested, null);
if(DEBUG) {
System.err.println(getThreadName() + ": Reusing chosenCaps: "+eglConfig);
}