aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-03 18:43:48 -0700
committerSven Gothel <[email protected]>2009-10-03 18:43:48 -0700
commit907c249a5a6f80d10912440aa073ba42b94ae6de (patch)
tree07bb12ad290cfb94704735ace1268c46e562632b /src/jogl/classes/com/sun/opengl
parentf043a48504b79409df4e674a15c87faa3f47c03f (diff)
EGL Fix: Use the surface handle for creation, not the window handle; More fixedCaps.
Diffstat (limited to 'src/jogl/classes/com/sun/opengl')
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java20
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java49
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java10
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java2
4 files changed, 53 insertions, 28 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index bb341ec52..11ed21f6c 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -75,7 +75,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
public abstract GLContext createContext(GLContext shareWith);
- protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg);
+ protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle);
private void recreateSurface() {
if(ownEGLSurface) {
@@ -88,10 +88,13 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println("createSurface using eglDisplay 0x"+Long.toHexString(eglDisplay)+", "+eglConfig);
}
- eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig());
+ eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), component.getSurfaceHandle());
+ if (EGL.EGL_NO_SURFACE==eglSurface) {
+ throw new GLException("Creation of window surface failed: "+eglConfig+", error 0x"+Integer.toHexString(EGL.eglGetError()));
+ }
if(DEBUG) {
- System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface));
+ System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface));
}
}
}
@@ -171,6 +174,17 @@ public abstract class EGLDrawable extends GLDrawableImpl {
} else if(DEBUG) {
System.err.println("Chosen eglConfig: "+eglConfig);
}
+ /**
+ eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), component.getSurfaceHandle());
+ while ( EGL.EGL_NO_SURFACE == eglSurface ) {
+ - blacklist EGLConfig entry
+ - retry ..
+ if ( no more EGLConfigs available ) {
+ break .. or .. exception
+ }
+ eglConfig.updateGraphicsConfiguration();
+ eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), component.getSurfaceHandle());
+ } */
}
recreateSurface();
} finally {
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index e2cbc5bab..861a89a75 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -149,33 +149,50 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
// Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..]
+ //
+ // rgb888 - d16, s4
GLCapabilities fixedCaps = new GLCapabilities(glp);
- /**
- fixedCaps.setRedBits(5);
- fixedCaps.setGreenBits(6);
- fixedCaps.setBlueBits(5); */
+ fixedCaps.setRedBits(8);
+ fixedCaps.setGreenBits(8);
+ fixedCaps.setBlueBits(8);
fixedCaps.setDepthBits(16);
fixedCaps.setSampleBuffers(true);
fixedCaps.setNumSamples(4);
if(DEBUG) {
- System.err.println("trying fixed caps: "+fixedCaps);
+ System.err.println("trying fixed caps (1): "+fixedCaps);
+ }
+ res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen, eglSurfaceType);
+ if(null!=res) {
+ return res;
}
- chosen = -1;
- try {
- chosen = chooser.chooseCapabilities(fixedCaps, caps, -1);
- } catch (NativeWindowException e) { throw new GLException(e); }
- if(chosen<0) {
- throw new GLException("Graphics configuration chooser fixed failed");
+ //
+ // rgb565 - d16, s0
+ fixedCaps = new GLCapabilities(glp);
+ fixedCaps.setRedBits(5);
+ fixedCaps.setGreenBits(6);
+ fixedCaps.setBlueBits(5);
+ fixedCaps.setDepthBits(16);
+ if(DEBUG) {
+ System.err.println("trying fixed caps (2): "+fixedCaps);
}
+ res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen, eglSurfaceType);
+ if(null!=res) {
+ return res;
+ }
+
+ //
+ // rgb565 - d16, s4
+ fixedCaps.setSampleBuffers(true);
+ fixedCaps.setNumSamples(4);
if(DEBUG) {
- System.err.println("Chosen fixed "+caps[chosen]);
+ System.err.println("trying fixed caps (3): "+fixedCaps);
}
- res = eglChooseConfig(eglDisplay, caps[chosen], capabilities, chooser, absScreen, eglSurfaceType);
- if(null==res) {
- throw new GLException("Graphics configuration failed [direct caps, eglGetConfig/chooser and fixed-caps]");
+ res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen, eglSurfaceType);
+ if(null!=res) {
+ return res;
}
- return res;
+ throw new GLException("Graphics configuration failed [direct caps, eglGetConfig/chooser and fixed-caps(1-3)]");
}
protected static EGLGraphicsConfiguration eglChooseConfig(long eglDisplay,
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
index 36117f059..45fffbc91 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -54,14 +54,8 @@ public class EGLOnscreenDrawable extends EGLDrawable {
return new EGLOnscreenContext(this, shareWith);
}
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg) {
- long surf = EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, component.getWindowHandle(), null);
- if (EGL.EGL_NO_SURFACE==surf) {
- throw new GLException("Creation of window surface (eglCreateWindowSurface) failed, component: "+component+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- } else if(DEBUG) {
- System.err.println("setSurface result: eglSurface 0x"+Long.toHexString(surf));
- }
- return surf;
+ protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
+ return EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, surfaceHandle, null);
}
protected void swapBuffersImpl() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
index 448112ae0..498372e55 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
@@ -103,7 +103,7 @@ public class EGLPbufferDrawable extends EGLDrawable {
return eglConfig;
}
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg) {
+ protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(width, height, texFormat);
long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0);
if (EGL.EGL_NO_SURFACE==surf) {