diff options
author | Sven Gothel <[email protected]> | 2014-12-07 03:40:07 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-12-07 03:40:07 +0100 |
commit | 9ea218a5990b908e04235c407c0951c60df6ffba (patch) | |
tree | 643ab99d4f4029a6143eb85d281f1568e2181b74 /src/nativewindow/classes/com | |
parent | a53e87a84c92444e8a3173f25ce86dcfd536d6a8 (diff) |
Bug 1068, 1096: Unify EGL surface related code in EGLSurface; Add notion of 'Surfaceless Upstream Surface'
Preparation for Bug 1068: GLContext creation and makeCurrent without default framebuffer
- Unify EGL surface related code in EGLSurface
- EGLWrappedSurface -> EGLSurface,
which utilizes a more straight forward
foreign upstream surface (X11, GDI, ..) to EGL mapping.
This also addresses Bug 1096, i.e. EGL Cleanup.
- Add notion of 'Surfaceless Upstream Surface'
- Add surfaceless 'fake' upstream surface hooks:
- EGLUpstreamSurfacelessHook
- X11UpstreamSurfacelessHook
Utilizing the ProxySurface option bit 'OPT_UPSTREAM_SURFACELESS'
signaling usage of 'no surface'.
- Add GLDrawableFactoryImpl.createSurfacelessImpl(..)
Diffstat (limited to 'src/nativewindow/classes/com')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java index d21994ea5..a38a48b85 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java @@ -34,11 +34,14 @@ package com.jogamp.nativewindow.egl; import javax.media.nativewindow.*; +import com.jogamp.common.util.VersionNumber; + /** Encapsulates a graphics device on EGL platforms. */ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable { - final long[] nativeDisplayID = new long[1]; - /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private final long[] nativeDisplayID = new long[1]; + private /* final */ EGLDisplayLifecycleCallback eglLifecycleCallback; + private VersionNumber eglVersion = VersionNumber.zeroVersion; /** * Hack to allow inject a EGL termination call. @@ -52,9 +55,11 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl * Implementation should issue an <code>EGL.eglGetDisplay(nativeDisplayID)</code> * inclusive <code>EGL.eglInitialize(eglDisplayHandle, ..)</code> call. * @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle + * @param major out array for EGL major version + * @param minor out array for EGL minor version * @return the initialized EGL display ID, or <code>0</code> if not successful */ - public long eglGetAndInitDisplay(long[] nativeDisplayID); + public long eglGetAndInitDisplay(final long[] nativeDisplayID, final int[] major, final int[] minor); /** * Implementation should issue an <code>EGL.eglTerminate(eglDisplayHandle)</code> call. @@ -79,6 +84,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl this.eglLifecycleCallback = eglLifecycleCallback; } + /** EGL server version as returned by {@code eglInitialize(..)}. Only valid after {@link #open()}. */ + public VersionNumber getEGLVersion() { return eglVersion; } + public long getNativeDisplayID() { return nativeDisplayID[0]; } @Override @@ -98,11 +106,16 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl if(DEBUG) { System.err.println(Thread.currentThread().getName() + " - EGLGraphicsDevice.open(): "+this); } - handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID); + final int[] major = { 0 }; + final int[] minor = { 0 }; + handle = eglLifecycleCallback.eglGetAndInitDisplay(nativeDisplayID, major, minor); if(0 == handle) { + eglVersion = VersionNumber.zeroVersion; throw new NativeWindowException("EGLGraphicsDevice.open() failed: "+this); + } else { + eglVersion = new VersionNumber(major[0], minor[0], 0); + return true; } - return true; } return false; } @@ -142,5 +155,10 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership; return oldOwnership; } + + @Override + public String toString() { + return getClass().getSimpleName()+"[type "+getType()+", v"+eglVersion+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]"; + } } |