aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/egl')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java74
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java148
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java47
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java (renamed from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java)76
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java (renamed from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java)51
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java (renamed from src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java)49
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java7
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java31
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java16
9 files changed, 200 insertions, 299 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
index 56ae649be..5671b033d 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
@@ -84,66 +84,35 @@ public abstract class EGLContext extends GLContextImpl {
protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
- protected int makeCurrentImpl() throws GLException {
+ protected void makeCurrentImpl(boolean newCreated) throws GLException {
if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
throw new GLException("drawable not properly initialized, NO DISPLAY: "+drawable);
}
- if (0 == drawable.getNativeWindow().getSurfaceHandle()) {
- throw new GLException("drawable has invalid surface handle: "+drawable);
- }
- boolean newCreated = false;
- if (!isCreated()) {
- create(); // throws exception if fails!
- newCreated = true;
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created GL context " + toHexString(contextHandle) + " for " + getClass().getName());
- }
- }
if (EGL.eglGetCurrentContext() != contextHandle) {
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
- ((EGLDrawable)drawable).getSurface(),
- ((EGLDrawable)drawableRead).getSurface(),
+ drawable.getHandle(),
+ drawableRead.getHandle(),
contextHandle)) {
throw new GLException("Error making context 0x" +
Long.toHexString(contextHandle) + " current: error code " + EGL.eglGetError());
}
}
-
- if(newCreated) {
- setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_ES|CTX_OPTION_ANY);
- return CONTEXT_CURRENT_NEW;
- }
- return CONTEXT_CURRENT;
}
protected void releaseImpl() throws GLException {
- getDrawableImpl().getFactoryImpl().lockToolkit();
- try {
- if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
- EGL.EGL_NO_SURFACE,
- EGL.EGL_NO_SURFACE,
- EGL.EGL_NO_CONTEXT)) {
- throw new GLException("Error freeing OpenGL context 0x" +
- Long.toHexString(contextHandle) + ": error code " + EGL.eglGetError());
- }
- } finally {
- getDrawableImpl().getFactoryImpl().unlockToolkit();
+ if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
+ EGL.EGL_NO_SURFACE,
+ EGL.EGL_NO_SURFACE,
+ EGL.EGL_NO_CONTEXT)) {
+ throw new GLException("Error freeing OpenGL context 0x" +
+ Long.toHexString(contextHandle) + ": error code " + EGL.eglGetError());
}
}
protected void destroyImpl() throws GLException {
- getDrawableImpl().getFactoryImpl().lockToolkit();
- try {
- if (contextHandle != 0) {
- if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), contextHandle)) {
- throw new GLException("Error destroying OpenGL context 0x" +
- Long.toHexString(contextHandle) + ": error code " + EGL.eglGetError());
- }
- contextHandle = 0;
- GLContextShareSet.contextDestroyed(this);
- }
- } finally {
- getDrawableImpl().getFactoryImpl().unlockToolkit();
+ if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), contextHandle)) {
+ throw new GLException("Error destroying OpenGL context 0x" +
+ Long.toHexString(contextHandle) + ": error code " + EGL.eglGetError());
}
}
@@ -155,7 +124,7 @@ public abstract class EGLContext extends GLContextImpl {
// FIXME
}
- protected void create() throws GLException {
+ protected boolean createImpl() throws GLException {
long eglDisplay = ((EGLDrawable)drawable).getDisplay();
EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
GLProfile glProfile = drawable.getGLProfile();
@@ -208,19 +177,20 @@ public abstract class EGLContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created OpenGL context 0x" +
Long.toHexString(contextHandle) +
- ",\n\twrite surface 0x" + Long.toHexString(((EGLDrawable)drawable).getSurface()) +
- ",\n\tread surface 0x" + Long.toHexString(((EGLDrawable)drawableRead).getSurface())+
+ ",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) +
+ ",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+
",\n\t"+this+
",\n\tsharing with 0x" + Long.toHexString(shareWith));
}
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
- ((EGLDrawable)drawable).getSurface(),
- ((EGLDrawable)drawableRead).getSurface(),
+ drawable.getHandle(),
+ drawableRead.getHandle(),
contextHandle)) {
throw new GLException("Error making context 0x" +
Long.toHexString(contextHandle) + " current: error code " + EGL.eglGetError());
}
setGLFunctionAvailability(true, glProfile.usesNativeGLES2()?2:1, 0, CTX_PROFILE_ES|CTX_OPTION_ANY);
+ return true;
}
protected void updateGLProcAddressTable(int major, int minor, int ctp) {
@@ -246,18 +216,12 @@ public abstract class EGLContext extends GLContextImpl {
eglQueryStringInitialized = true;
}
if (eglQueryStringAvailable) {
- GLDrawableFactoryImpl factory = getDrawableImpl().getFactoryImpl();
- factory.lockToolkit();
- try {
String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_EXTENSIONS);
if (DEBUG) {
System.err.println("!!! EGL extensions: " + ret);
}
return ret;
- } finally {
- factory.unlockToolkit();
- }
} else {
return "";
}
@@ -277,7 +241,7 @@ public abstract class EGLContext extends GLContextImpl {
// Currently unimplemented stuff
//
- public void copy(GLContext source, int mask) throws GLException {
+ protected void copyImpl(GLContext source, int mask) throws GLException {
throw new GLException("Not yet implemented");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index a36973de1..7eeb19141 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -60,7 +60,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return eglDisplay;
}
- public long getSurface() {
+ public long getHandle() {
return eglSurface;
}
@@ -98,85 +98,83 @@ public abstract class EGLDrawable extends GLDrawableImpl {
protected void setRealizedImpl() {
if (realized) {
- if ( NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface() ) {
- throw new GLException("Couldn't lock surface");
- }
- // lockSurface() also resolved the window/surface handles
- try {
- AbstractGraphicsConfiguration aConfig = component.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice();
- if(aDevice instanceof EGLGraphicsDevice) {
- // just fetch the data .. trust but verify ..
- eglDisplay = aDevice.getHandle();
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Invalid EGL display in EGLGraphicsDevice from "+aDevice);
+ AbstractGraphicsConfiguration aConfig = component.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice();
+ if(aDevice instanceof EGLGraphicsDevice) {
+ if(DEBUG) {
+ System.err.println("EGLDrawable.setRealized: using existing EGL config: "+this);
+ }
+ // just fetch the data .. trust but verify ..
+ eglDisplay = aDevice.getHandle();
+ if (eglDisplay == EGL.EGL_NO_DISPLAY) {
+ throw new GLException("Invalid EGL display in EGLGraphicsDevice from "+aDevice);
+ }
+ if(aConfig instanceof EGLGraphicsConfiguration) {
+ eglConfig = (EGLGraphicsConfiguration) aConfig; // done ..
+ if (null == eglConfig) {
+ throw new GLException("Null EGLGraphicsConfiguration from "+aConfig);
}
- if(aConfig instanceof EGLGraphicsConfiguration) {
- eglConfig = (EGLGraphicsConfiguration) aConfig; // done ..
- if (null == eglConfig) {
- throw new GLException("Null EGLGraphicsConfiguration from "+aConfig);
- }
- int[] tmp = new int[1];
- if ( 0 != component.getSurfaceHandle() &&
- EGL.eglQuerySurface(eglDisplay, component.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) {
- // component holds static EGLSurface
- eglSurface = component.getSurfaceHandle();
- if(DEBUG) {
- System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface));
- }
- } else {
- // EGLSurface is ours ..
- ownEGLSurface=true;
-
- eglConfig.updateGraphicsConfiguration();
-
- recreateSurface();
+ int[] tmp = new int[1];
+ if ( 0 != component.getSurfaceHandle() &&
+ EGL.eglQuerySurface(eglDisplay, component.getSurfaceHandle(), EGL.EGL_CONFIG_ID, tmp, 0) ) {
+ // component holds static EGLSurface
+ eglSurface = component.getSurfaceHandle();
+ if(DEBUG) {
+ System.err.println("setSurface re-using component's EGLSurface: handle 0x"+Long.toHexString(eglSurface));
}
} else {
- throw new GLException("EGLGraphicsDevice hold by non EGLGraphicsConfiguration: "+aConfig);
+ // EGLSurface is ours ..
+ ownEGLSurface=true;
+
+ eglConfig.updateGraphicsConfiguration();
+
+ recreateSurface();
}
} else {
- // create a new EGL config ..
- ownEGLDisplay=true;
- // EGLSurface is ours ..
- ownEGLSurface=true;
-
- long nDisplay=0;
- if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) {
- nDisplay = component.getSurfaceHandle(); // don't even ask ..
- } else {
- nDisplay = aDevice.getHandle(); // 0 == EGL.EGL_DEFAULT_DISPLAY
+ throw new GLException("EGLGraphicsDevice hold by non EGLGraphicsConfiguration: "+aConfig);
+ }
+ } else {
+ if(DEBUG) {
+ System.err.println("EGLDrawable.setRealized: creating new EGL config: "+this);
+ }
+ // create a new EGL config ..
+ ownEGLDisplay=true;
+ // EGLSurface is ours ..
+ ownEGLSurface=true;
+
+ long nDisplay=0;
+ if( NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) {
+ nDisplay = component.getSurfaceHandle(); // don't even ask ..
+ } else {
+ nDisplay = aDevice.getHandle(); // 0 == EGL.EGL_DEFAULT_DISPLAY
+ }
+ eglDisplay = EGL.eglGetDisplay(nDisplay);
+ if (eglDisplay == EGL.EGL_NO_DISPLAY) {
+ if(DEBUG) {
+ System.err.println("eglDisplay("+Long.toHexString(nDisplay)+" <surfaceHandle>): failed, using EGL_DEFAULT_DISPLAY");
}
+ nDisplay = EGL.EGL_DEFAULT_DISPLAY;
eglDisplay = EGL.eglGetDisplay(nDisplay);
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- if(DEBUG) {
- System.err.println("eglDisplay("+Long.toHexString(nDisplay)+" <surfaceHandle>): failed, using EGL_DEFAULT_DISPLAY");
- }
- nDisplay = EGL.EGL_DEFAULT_DISPLAY;
- eglDisplay = EGL.eglGetDisplay(nDisplay);
- }
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Failed to created EGL display: nhandle 0x"+Long.toHexString(nDisplay)+", "+aDevice+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- } else if(DEBUG) {
- System.err.println("eglDisplay("+Long.toHexString(nDisplay)+"): 0x"+Long.toHexString(eglDisplay));
- }
- if (!EGL.eglInitialize(eglDisplay, null, null)) {
- throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay);
- DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
- GLCapabilities caps = (GLCapabilities) aConfig.getChosenCapabilities(); // yes, use the already choosen Capabilities (x11,win32,..)
- eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(caps, null, s);
- if (null == eglConfig) {
- throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
- } else if(DEBUG) {
- System.err.println("Chosen eglConfig: "+eglConfig);
- }
- recreateSurface();
}
- } finally {
- unlockSurface();
+ if (eglDisplay == EGL.EGL_NO_DISPLAY) {
+ throw new GLException("Failed to created EGL display: nhandle 0x"+Long.toHexString(nDisplay)+", "+aDevice+", error 0x"+Integer.toHexString(EGL.eglGetError()));
+ } else if(DEBUG) {
+ System.err.println("eglDisplay("+Long.toHexString(nDisplay)+"): 0x"+Long.toHexString(eglDisplay));
+ }
+ if (!EGL.eglInitialize(eglDisplay, null, null)) {
+ throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
+ }
+ EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay);
+ DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
+ GLCapabilities caps = (GLCapabilities) aConfig.getChosenCapabilities(); // yes, use the already choosen Capabilities (x11,win32,..)
+ eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(caps, null, s);
+ if (null == eglConfig) {
+ throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
+ } else if(DEBUG) {
+ System.err.println("Chosen eglConfig: "+eglConfig);
+ }
+ recreateSurface();
}
} else if (ownEGLSurface && eglSurface != EGL.EGL_NO_SURFACE) {
// Destroy the window surface
@@ -209,7 +207,13 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return EGLDynamicLookupHelper.getEGLDynamicLookupHelper(getGLProfile());
+ if (getGLProfile().usesNativeGLES2()) {
+ return getFactoryImpl().getGLDynamicLookupHelper(2);
+ } else if (getGLProfile().usesNativeGLES1()) {
+ return getFactoryImpl().getGLDynamicLookupHelper(1);
+ } else {
+ throw new GLException("Unsupported: "+getGLProfile());
+ }
}
public String toString() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index f74c7858f..935281c6c 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -44,6 +44,9 @@ import com.jogamp.nativewindow.impl.NullWindow;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
+ private static final GLDynamicLookupHelper eglES1DynamicLookupHelper;
+ private static final GLDynamicLookupHelper eglES2DynamicLookupHelper;
+
static {
// Register our GraphicsConfigurationFactory implementations
// The act of constructing them causes them to be registered
@@ -55,6 +58,36 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
ReflectionUtil.createInstance("com.jogamp.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory");
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
+
+ // FIXME: Probably need to move EGL from a static model
+ // to a dynamic one, where there can be 2 instances
+ // for each ES profile with their own ProcAddressTable.
+
+ GLDynamicLookupHelper tmp=null;
+ try {
+ tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo());
+ } catch (GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
+ }
+ }
+ eglES1DynamicLookupHelper = tmp;
+ if(null!=eglES1DynamicLookupHelper && eglES1DynamicLookupHelper.isLibComplete()) {
+ EGL.resetProcAddressTable(eglES1DynamicLookupHelper);
+ }
+
+ tmp=null;
+ try {
+ tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo());
+ } catch (GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
+ }
+ }
+ eglES2DynamicLookupHelper = tmp;
+ if(null!=eglES2DynamicLookupHelper && eglES2DynamicLookupHelper.isLibComplete()) {
+ EGL.resetProcAddressTable(eglES2DynamicLookupHelper);
+ }
}
public EGLDrawableFactory() {
@@ -62,7 +95,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) {
- return EGLDynamicLookupHelper.getEGLDynamicLookupHelper(esProfile);
+ if (2==esProfile) {
+ if(null==eglES2DynamicLookupHelper) {
+ throw new GLException("GLDynamicLookupHelper for ES2 not available");
+ }
+ return eglES2DynamicLookupHelper;
+ } else if (1==esProfile) {
+ if(null==eglES1DynamicLookupHelper) {
+ throw new GLException("GLDynamicLookupHelper for ES1 not available");
+ }
+ return eglES1DynamicLookupHelper;
+ } else {
+ throw new GLException("Unsupported: ES"+esProfile);
+ }
}
protected void shutdown() {}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java
index 28cfb4f1e..675be64b5 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java
@@ -41,84 +41,32 @@ import java.security.*;
*
* Currently two implementations exist, one for ES1 and one for ES2.
*/
-public abstract class EGLDynamicLookupHelper extends GLDynamicLookupHelper {
- private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper;
- private static final EGLDynamicLookupHelper eglES2DynamicLookupHelper;
+public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo {
- static {
- EGLDynamicLookupHelper tmp=null;
- try {
- tmp = new EGLES1DynamicLookupHelper();
- } catch (GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
- }
- eglES1DynamicLookupHelper = tmp;
-
- tmp=null;
- try {
- tmp = new EGLES2DynamicLookupHelper();
- } catch (GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
- }
- eglES2DynamicLookupHelper = tmp;
+ protected EGLDynamicLibraryBundleInfo() {
+ super();
}
- public static EGLDynamicLookupHelper getEGLDynamicLookupHelper(GLProfile glp) {
- if (glp.usesNativeGLES2()) {
- return getEGLDynamicLookupHelper(2);
- } else if (glp.usesNativeGLES1()) {
- return getEGLDynamicLookupHelper(1);
- } else {
- throw new GLException("Unsupported: "+glp);
- }
- }
+ /** Might be a desktop GL library, and might need to allow symbol access to subsequent libs */
+ public boolean shallLinkGlobal() { return true; }
- public static EGLDynamicLookupHelper getEGLDynamicLookupHelper(int esProfile) {
- if (2==esProfile) {
- if(null==eglES2DynamicLookupHelper) {
- throw new GLException("EGLDynamicLookupHelper for ES2 not available");
- }
- return eglES2DynamicLookupHelper;
- } else if (1==esProfile) {
- if(null==eglES1DynamicLookupHelper) {
- throw new GLException("EGLDynamicLookupHelper for ES1 not available");
- }
- return eglES1DynamicLookupHelper;
- } else {
- throw new GLException("Unsupported: ES"+esProfile);
- }
+ public final List getToolGetProcAddressFuncNameList() {
+ List res = new ArrayList();
+ res.add("eglGetProcAddress");
+ return res;
}
- protected EGLDynamicLookupHelper() {
- super();
- EGL.resetProcAddressTable(this);
+ public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
}
- protected boolean hasESBinding = false;
- public boolean hasESBinding() { return hasESBinding; }
-
- protected final List/*<String>*/ getGLXLibNames() {
+ protected List/*<String>*/ getEGLLibNamesList() {
List/*<String>*/ eglLibNames = new ArrayList();
-
// EGL
eglLibNames.add("EGL");
// for windows distributions using the 'unlike' lib prefix,
// where our tool does not add it.
eglLibNames.add("libEGL");
-
return eglLibNames;
}
-
- protected final String getGLXGetProcAddressFuncName() {
- return "eglGetProcAddress" ;
- }
-
- protected final long dynamicLookupFunctionOnGLX(long glxGetProcAddressHandle, String glFuncName) {
- return EGL.eglGetProcAddress(glxGetProcAddressHandle, glFuncName);
- }
}
-
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java
index 9599e1457..aad25edc4 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java
@@ -30,38 +30,22 @@ package com.jogamp.opengl.impl.egl;
import java.util.*;
import com.jogamp.opengl.impl.*;
-/**
- * Implementation of the EGLDynamicLookupHelper for ES1.
- */
-public class EGLES1DynamicLookupHelper extends EGLDynamicLookupHelper {
-
- protected EGLES1DynamicLookupHelper() {
- super();
+public class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
+ static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+ glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
+ glueLibNames.add("jogl_es1");
}
- protected void loadGLJNILibrary() {
- Throwable t=null;
- try {
- GLJNILibLoader.loadES1();
- hasESBinding = true;
- } catch (UnsatisfiedLinkError ule) {
- t=ule;
- } catch (SecurityException se) {
- t=se;
- } catch (NullPointerException npe) {
- t=npe;
- } catch (RuntimeException re) {
- t=re;
- }
- if(DEBUG && null!=t) {
- System.err.println("EGLES1DynamicLookupHelper: ES1 Binding Library not available");
- t.printStackTrace();
- }
+ protected EGLES1DynamicLibraryBundleInfo() {
+ super();
}
- protected List/*<String>*/ getGLLibNames() {
- List/*<String>*/ glesLibNames = new ArrayList();
+ public List getToolLibNames() {
+ List/*<List>*/ libNames = new ArrayList();
+ List/*<String>*/ glesLibNames = new ArrayList();
glesLibNames.add("GLES_CM");
glesLibNames.add("GLES_CL");
glesLibNames.add("GLESv1_CM");
@@ -70,8 +54,19 @@ public class EGLES1DynamicLookupHelper extends EGLDynamicLookupHelper {
glesLibNames.add("libGLES_CM");
glesLibNames.add("libGLES_CL");
glesLibNames.add("libGLESv1_CM");
+ // last but not least, we may even use the desktop GL library,
+ // which would be eg Mesa + Gallium EGL ..
+ glesLibNames.add("libGL.so.1");
+ glesLibNames.add("libGL.so");
+ glesLibNames.add("GL");
+
+ libNames.add(glesLibNames);
+ libNames.add(getEGLLibNamesList());
+ return libNames;
+ }
- return glesLibNames;
+ public List/*<String>*/ getGlueLibNames() {
+ return glueLibNames;
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java
index c00fa0e93..9691b2bd0 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java
@@ -30,38 +30,22 @@ package com.jogamp.opengl.impl.egl;
import java.util.*;
import com.jogamp.opengl.impl.*;
-/**
- * Implementation of the EGLDynamicLookupHelper for ES2.
- */
-public class EGLES2DynamicLookupHelper extends EGLDynamicLookupHelper {
+public class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
+ static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+ glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
+ glueLibNames.add("jogl_es2");
+ }
- protected EGLES2DynamicLookupHelper() {
+ protected EGLES2DynamicLibraryBundleInfo() {
super();
}
- protected void loadGLJNILibrary() {
- Throwable t=null;
- try {
- GLJNILibLoader.loadES2();
- hasESBinding = true;
- } catch (UnsatisfiedLinkError ule) {
- t=ule;
- } catch (SecurityException se) {
- t=se;
- } catch (NullPointerException npe) {
- t=npe;
- } catch (RuntimeException re) {
- t=re;
- }
- if(DEBUG && null!=t) {
- System.err.println("EGLES2DynamicLookupHelper: ES2 Binding Library not available");
- t.printStackTrace();
- }
- }
+ public List getToolLibNames() {
+ List/*<List>*/ libNames = new ArrayList();
- protected List/*<String>*/ getGLLibNames() {
List/*<String>*/ glesLibNames = new ArrayList();
-
glesLibNames.add("GLES20");
glesLibNames.add("GLESv2");
glesLibNames.add("GLESv2_CM");
@@ -70,8 +54,19 @@ public class EGLES2DynamicLookupHelper extends EGLDynamicLookupHelper {
glesLibNames.add("libGLES20");
glesLibNames.add("libGLESv2");
glesLibNames.add("libGLESv2_CM");
+ // last but not least, we may even use the desktop GL library,
+ // which would be eg Mesa + Gallium EGL ..
+ glesLibNames.add("libGL.so.1");
+ glesLibNames.add("libGL.so");
+ glesLibNames.add("GL");
+
+ libNames.add(glesLibNames);
+ libNames.add(getEGLLibNamesList());
+ return libNames;
+ }
- return glesLibNames;
+ public List/*<String>*/ getGlueLibNames() {
+ return glueLibNames;
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
index f5f027f94..ae8b5bf70 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
@@ -67,21 +67,16 @@ public class EGLExternalContext extends EGLContext {
lastContext = null;
}
- protected int makeCurrentImpl() throws GLException {
+ protected void makeCurrentImpl(boolean newCreated) throws GLException {
if (firstMakeCurrent) {
firstMakeCurrent = false;
- // FIXME: set contextHandle
- return CONTEXT_CURRENT_NEW;
}
- return CONTEXT_CURRENT;
}
protected void releaseImpl() throws GLException {
}
protected void destroyImpl() throws GLException {
- contextHandle = 0 ;
- GLContextShareSet.contextDestroyed(this);
}
public void bindPbufferToTexture() {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
index b74991671..cb8b01d8d 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
@@ -47,37 +47,6 @@ public class EGLOnscreenContext extends EGLContext {
super(drawable, shareWith);
}
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected int makeCurrentImpl() throws GLException {
- int lockRes = drawable.lockSurface();
- boolean exceptionOccurred = false;
- try {
- if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return CONTEXT_NOT_CURRENT;
- }
- return super.makeCurrentImpl();
- } catch (RuntimeException e) {
- exceptionOccurred = true;
- throw e;
- } finally {
- if (exceptionOccurred ||
- (isOptimizable() && lockRes != NativeWindow.LOCK_SURFACE_NOT_READY) && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
-
- // Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
- protected void releaseImpl() throws GLException {
- try {
- super.releaseImpl();
- } finally {
- if (!isOptimizable() && drawable.isSurfaceLocked()) {
- drawable.unlockSurface();
- }
- }
- }
-
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
index 3864fc39c..551a21ed6 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -59,21 +59,7 @@ public class EGLOnscreenDrawable extends EGLDrawable {
}
protected void swapBuffersImpl() {
- boolean didLock = false;
- if (!isSurfaceLocked()) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
- }
- try {
- EGL.eglSwapBuffers(eglDisplay, eglSurface);
- } finally {
- if (didLock) {
- unlockSurface();
- }
- }
+ EGL.eglSwapBuffers(eglDisplay, eglSurface);
}
}