summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java1
4 files changed, 32 insertions, 17 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);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index 2e1793d72..0ae597938 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -29,14 +29,13 @@
package jogamp.opengl.egl;
import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
public class EGLGLCapabilities extends GLCapabilities {
- final private long eglcfg;
+ private long eglcfg;
final private int eglcfgid;
final private int renderableType;
final private int nativeVisualID;
@@ -74,7 +73,8 @@ public class EGLGLCapabilities extends GLCapabilities {
throw new GLException(e);
}
}
-
+
+ final protected void setEGLConfig(long v) { eglcfg=v; }
final public long getEGLConfig() { return eglcfg; }
final public int getEGLConfigID() { return eglcfgid; }
final public int getRenderableType() { return renderableType; }
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()+
"]";
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 2d9fc0227..aac7f5f85 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -285,6 +285,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
throw new GLException("Graphics configuration failed [direct caps, eglGetConfig/chooser and fixed-caps(1-3)]");
}
if(ownEGLDisplay) {
+ ((EGLGLCapabilities) res.getChosenCapabilities()).setEGLConfig(0); // eglDisplay: EOL
EGLDisplayUtil.eglTerminate(eglDisplay);
}
return res;