diff options
author | Sven Gothel <[email protected]> | 2008-11-13 20:26:57 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2008-11-13 20:26:57 +0000 |
commit | c25a62a71154340da6b50e56ceef3fa780f89a93 (patch) | |
tree | 8fdec21df1774d491e165814e1a2e0067b84289f /src/classes/com/sun/opengl/impl/egl | |
parent | 9802bc053ef45140690bb58232429d225dfe0f75 (diff) |
- Removed StaticGLInfo usage.
Function availability is checked by the dynamic ProcAddressTable,
so it works as described/desired and removed around 30 kB of text.
- Adding EGLExt to support EGLImage to share video buffers
between another API (e.g. OpenMax)
- EGL: Added platform extension query support
- EGLClientBuffer is opaque long
- GLXExt: Removed duplicated enumerates from GLX
- GLContext: Promoted getPlatformExtensionsString()
- GLProfile.setProfile<GL*>(void) changed order of
setting the GL profile to: highest -> lowest:
GL2 .. GL2ES12 .. GLES2 .. GLES1
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1784 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/opengl/impl/egl')
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLContext.java | 97 | ||||
-rwxr-xr-x | src/classes/com/sun/opengl/impl/egl/EGLDrawable.java | 8 |
2 files changed, 83 insertions, 22 deletions
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java index 3a23483cb..bb36082f5 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLContext.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java @@ -37,21 +37,56 @@ package com.sun.opengl.impl.egl; import javax.media.opengl.*; import com.sun.opengl.impl.*; +import com.sun.gluegen.runtime.ProcAddressTable; import java.nio.*; +import java.util.*; public class EGLContext extends GLContextImpl { private EGLDrawable drawable; private long context; + private boolean eglQueryStringInitialized; + private boolean eglQueryStringAvailable; + private EGLExt eglExt; + // Table that holds the addresses of the native C-language entry points for + // EGL extension functions. + private EGLExtProcAddressTable eglExtProcAddressTable; public EGLContext(EGLDrawable drawable, GLContext shareWith) { super(shareWith); this.drawable = drawable; } + public Object getPlatformGLExtensions() { + return getEGLExt(); + } + + public EGLExt getEGLExt() { + if (eglExt == null) { + eglExt = new EGLExtImpl(this); + } + return eglExt; + } + + public final ProcAddressTable getPlatformExtProcAddressTable() { + return eglExtProcAddressTable; + } + + public final EGLExtProcAddressTable getEGLExtProcAddressTable() { + return eglExtProcAddressTable; + } + public GLDrawable getGLDrawable() { return drawable; } + protected String mapToRealGLFunctionName(String glFunctionName) { + return glFunctionName; + } + + protected String mapToRealGLExtensionName(String glExtensionName) { + return glExtensionName; + } + public long getContext() { return context; } @@ -146,13 +181,13 @@ public class EGLContext extends GLContextImpl { protected void create() throws GLException { long display = drawable.getDisplay(); - _EGLConfig config = drawable.getConfig(); + long config = drawable.getConfig(); long shareWith = 0; if (display == 0) { throw new GLException("Error: attempted to create an OpenGL context without a display connection"); } - if (config == null) { + if (config == 0) { throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration"); } EGLContext other = (EGLContext) GLContextShareSet.getShareContext(this); @@ -189,14 +224,52 @@ public class EGLContext extends GLContextImpl { return (context != 0); } + protected void resetGLFunctionAvailability() { + super.resetGLFunctionAvailability(); + if (DEBUG) { + System.err.println(getThreadName() + ": !!! Initializing EGL extension address table"); + } + if (eglExtProcAddressTable == null) { + // FIXME: cache ProcAddressTables by capability bits so we can + // share them among contexts with the same capabilities + eglExtProcAddressTable = new EGLExtProcAddressTable(); + } + resetProcAddressTable(getEGLExtProcAddressTable()); + } + + public synchronized String getPlatformExtensionsString() { + if (!eglQueryStringInitialized) { + eglQueryStringAvailable = + ((GLDrawableFactoryImpl)getGLDrawable().getFactory()).dynamicLookupFunction("eglQueryString") != 0; + eglQueryStringInitialized = true; + } + if (eglQueryStringAvailable) { + GLDrawableFactory factory = getGLDrawable().getFactory(); + boolean wasLocked = factory.isToolkitLocked(); + if(!wasLocked) { + factory.lockToolkit(); + } + try { + String ret = EGL.eglQueryString(drawable.getNativeWindow().getDisplayHandle(), + EGL.EGL_EXTENSIONS); + if (DEBUG) { + System.err.println("!!! EGL extensions: " + ret); + } + return ret; + } finally { + if(!wasLocked) { + factory.unlockToolkit(); + } + } + } else { + return ""; + } + } + //---------------------------------------------------------------------- // Currently unimplemented stuff // - public Object getPlatformGLExtensions() { - return null; - } - public void copy(GLContext source, int mask) throws GLUnsupportedException { throw new GLUnsupportedException("Not yet implemented"); } @@ -213,18 +286,6 @@ public class EGLContext extends GLContextImpl { throw new GLException("Should not call this"); } - protected String mapToRealGLFunctionName(String glFunctionName) { - return glFunctionName; - } - - protected String mapToRealGLExtensionName(String glExtensionName) { - return glExtensionName; - } - - public String getPlatformExtensionsString() { - return ""; - } - public boolean offscreenImageNeedsVerticalFlip() { throw new GLException("Should not call this"); } diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java index 60aed64be..edf793c29 100755 --- a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java @@ -42,7 +42,7 @@ import javax.media.opengl.*; public class EGLDrawable extends GLDrawableImpl { private GLCapabilitiesChooser chooser; private long display; - private _EGLConfig config; + private long config; private long surface; private int[] tmp = new int[1]; @@ -63,11 +63,11 @@ public class EGLDrawable extends GLDrawableImpl { throw new GLException("eglInitialize failed"); } int[] attrs = factory.glCapabilities2AttribList(capabilities); - _EGLConfig[] configs = new _EGLConfig[1]; + long[] configs = new long[1]; int[] numConfigs = new int[1]; if (!EGL.eglChooseConfig(display, attrs, 0, - configs, 1, + configs, 0, 1, numConfigs, 0)) { throw new GLException("Graphics configuration selection (eglChooseConfig) failed"); } @@ -90,7 +90,7 @@ public class EGLDrawable extends GLDrawableImpl { super.destroy(); } - public _EGLConfig getConfig() { + public long getConfig() { return config; } |