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.java76
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java152
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java52
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java72
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java270
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java72
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java68
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java72
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java68
-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
12 files changed, 365 insertions, 591 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 e64b5bcf2..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) {
@@ -242,22 +212,16 @@ public abstract class EGLContext extends GLContextImpl {
public synchronized String getPlatformExtensionsString() {
if (!eglQueryStringInitialized) {
eglQueryStringAvailable =
- getDrawableImpl().getDynamicLookupHelper().dynamicLookupFunction("eglQueryString") != 0;
+ getDrawableImpl().getGLDynamicLookupHelper().dynamicLookupFunction("eglQueryString") != 0;
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 2e24abcec..7eeb19141 100755
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -35,7 +35,7 @@
package com.jogamp.opengl.impl.egl;
-import com.jogamp.common.os.DynamicLookupHelper;
+import com.jogamp.opengl.impl.GLDynamicLookupHelper;
import com.jogamp.opengl.impl.GLDrawableImpl;
import javax.media.nativewindow.*;
@@ -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
@@ -208,8 +206,14 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return tmp[0];
}
- public DynamicLookupHelper getDynamicLookupHelper() {
- return EGLDynamicLookupHelper.getDynamicLookupHelper(getGLProfile());
+ public GLDynamicLookupHelper getGLDynamicLookupHelper() {
+ 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 fb0da9c40..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,12 +58,58 @@ 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() {
super();
}
+ public GLDynamicLookupHelper getGLDynamicLookupHelper(int 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() {}
protected final GLDrawableImpl getSharedDrawable() { return null; }
protected final GLContextImpl getSharedContext() { return null; }
@@ -103,9 +152,6 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Not yet implemented");
}
- public void loadGLULibrary() {
- }
-
public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java
new file mode 100755
index 000000000..675be64b5
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLibraryBundleInfo.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sven Gothel nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.jogamp.opengl.impl.egl;
+
+import com.jogamp.common.os.DynamicLookupHelper;
+import com.jogamp.common.os.NativeLibrary;
+import java.util.*;
+import javax.media.nativewindow.*;
+import javax.media.opengl.*;
+import com.jogamp.opengl.impl.*;
+import java.security.*;
+
+/**
+ * Abstract implementation of the DynamicLookupHelper for EGL,
+ * which decouples it's dependencies to EGLDrawable.
+ *
+ * Currently two implementations exist, one for ES1 and one for ES2.
+ */
+public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo {
+
+ protected EGLDynamicLibraryBundleInfo() {
+ super();
+ }
+
+ /** Might be a desktop GL library, and might need to allow symbol access to subsequent libs */
+ public boolean shallLinkGlobal() { return true; }
+
+ public final List getToolGetProcAddressFuncNameList() {
+ List res = new ArrayList();
+ res.add("eglGetProcAddress");
+ return res;
+ }
+
+ public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
+ }
+
+ 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;
+ }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java
deleted file mode 100755
index 9e34dc9e9..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.egl;
-
-import com.jogamp.common.os.DynamicLookupHelper;
-import com.jogamp.common.os.NativeLibrary;
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.jogamp.opengl.impl.*;
-import java.security.*;
-
-/**
- * Abstract implementation of the DynamicLookupHelper for EGL,
- * which decouples it's dependencies to EGLDrawableFactory.
- *
- * Currently two implementations exist, one for ES1 and one for ES2.
- */
-public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
- protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("EGL");
- protected static final boolean DEBUG_LOOKUP;
-
- private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper;
- private static final EGLDynamicLookupHelper eglES2DynamicLookupHelper;
- private List/*<NativeLibrary>*/ glesLibraries;
-
- static {
- AccessControlContext localACC=AccessController.getContext();
- DEBUG_LOOKUP = com.jogamp.opengl.impl.Debug.isPropertyDefined("jogl.debug.DynamicLookup", true, localACC);
-
- 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;
- }
-
- public static EGLDynamicLookupHelper getDynamicLookupHelper(GLProfile glp) {
- if (glp.usesNativeGLES2()) {
- if(null==eglES2DynamicLookupHelper) {
- throw new GLException("EGLDynamicLookupHelper for ES2 not available");
- }
- return eglES2DynamicLookupHelper;
- } else if (glp.usesNativeGLES1()) {
- if(null==eglES1DynamicLookupHelper) {
- throw new GLException("EGLDynamicLookupHelper for ES1 not available");
- }
- return eglES1DynamicLookupHelper;
- } else {
- throw new GLException("Unsupported: "+glp);
- }
- }
-
- public static EGLDynamicLookupHelper getDynamicLookupHelper(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);
- }
- }
-
- protected EGLDynamicLookupHelper() {
- loadGLESLibrary(getESProfile());
- EGL.resetProcAddressTable(this);
- }
-
- /** Must return the proper ES profile number, 1 for ES1 and 2 for ES2 */
- protected abstract int getESProfile();
-
- /** Must return at least one OpenGL ES library name */
- protected abstract List/*<String>*/ getGLESLibNames();
-
- /** May return OpenGL ES library name(s) */
- protected List/*<String>*/ getEGLLibNames() {
- 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;
- }
-
- private NativeLibrary loadFirstAvailable(List/*<String>*/ libNames, ClassLoader loader) {
- for (Iterator iter = libNames.iterator(); iter.hasNext(); ) {
- NativeLibrary lib = NativeLibrary.open((String) iter.next(), loader, false /*global*/);
- if (lib != null) {
- return lib;
- }
- }
- return null;
- }
-
- private boolean loadEGLLibrary(ClassLoader loader, List/*<String>*/ eglLibNames) {
- NativeLibrary lib = null;
- if(null!=eglLibNames && eglLibNames.size()>0) {
- // EGL libraries ..
- lib = loadFirstAvailable(eglLibNames, loader);
- if ( null != lib ) {
- glesLibraries.add(lib);
- }
- }
- return null!=lib;
- }
-
- private void loadGLESLibrary(int esProfile) {
- List/*<String>*/ glesLibNames = getGLESLibNames();
- List/*<String>*/ eglLibNames = getEGLLibNames();
- boolean eglLoaded = false;
-
- ClassLoader loader = getClass().getClassLoader();
- NativeLibrary lib = null;
-
- glesLibraries = new ArrayList();
-
- // ES libraries ..
- lib = loadFirstAvailable(glesLibNames, loader);
- if ( null == lib ) {
- /*** FIXME: Have to think about this ..
- // try again with EGL loaded first ..
- if ( !eglLoaded && loadEGLLibrary(loader, eglLibNames) ) {
- eglLoaded = true ;
- lib = loadFirstAvailable(glesLibNames, loader);
- }
- if ( null == lib ) {
- throw new GLException("Unable to dynamically load OpenGL ES library for profile ES" + esProfile);
- } */
- throw new GLException("Unable to dynamically load OpenGL ES library for profile ES" + esProfile);
- }
- glesLibraries.add(lib);
-
- if ( !eglLoaded && !loadEGLLibrary(loader, eglLibNames) ) {
- throw new GLException("Unable to dynamically load EGL library for profile ES" + esProfile);
- }
-
- if (esProfile==2) {
- GLJNILibLoader.loadES2();
- } else if (esProfile==1) {
- GLJNILibLoader.loadES1();
- } else {
- throw new GLException("Unsupported: ES"+esProfile);
- }
- }
-
- private long dynamicLookupFunctionOnLibs(String glFuncName) {
- String funcName=glFuncName;
- long addr = dynamicLookupFunctionOnLibsImpl(funcName);
- if( 0==addr && NativeWindowFactory.TYPE_WINDOWS.equals(NativeWindowFactory.getNativeWindowType(false)) ) {
- // Hack: try some C++ decoration here for Imageon's emulation libraries ..
- final int argAlignment=4; // 4 byte alignment of each argument
- final int maxArguments=12; // experience ..
- for(int arg=0; 0==addr && arg<=maxArguments; arg++) {
- funcName = "_"+glFuncName+"@"+(arg*argAlignment);
- addr = dynamicLookupFunctionOnLibsImpl(funcName);
- }
- }
- if(DEBUG_LOOKUP) {
- if(0!=addr) {
- System.err.println("Lookup-Native: "+glFuncName+" / "+funcName+" 0x"+Long.toHexString(addr));
- } else {
- System.err.println("Lookup-Native: "+glFuncName+" / "+funcName+" ** FAILED ** ");
- }
- }
- return addr;
- }
-
- private long dynamicLookupFunctionOnLibsImpl(String glFuncName) {
- // Look up this function name in all known libraries
- for (Iterator iter = glesLibraries.iterator(); iter.hasNext(); ) {
- NativeLibrary lib = (NativeLibrary) iter.next();
- long addr = lib.dynamicLookupFunction(glFuncName);
- if (addr != 0) {
- return addr;
- }
- }
- return 0;
- }
-
- private long eglGetProcAddressHandle = 0;
-
- public long dynamicLookupFunction(String glFuncName) {
- if(null==glFuncName) {
- return 0;
- }
-
- // bootstrap eglGetProcAddress
- if(0==eglGetProcAddressHandle) {
- eglGetProcAddressHandle = dynamicLookupFunctionOnLibs("eglGetProcAddress");
- if(0==eglGetProcAddressHandle) {
- GLException e = new GLException("Couldn't find eglGetProcAddress function entry");
- if(DEBUG) {
- e.printStackTrace();
- }
- throw e;
- }
- }
-
- if(glFuncName.equals("eglGetProcAddress")) {
- return eglGetProcAddressHandle;
- }
-
- long addr = EGL.eglGetProcAddress(eglGetProcAddressHandle, glFuncName);
- if(DEBUG_LOOKUP) {
- if(0!=addr) {
- System.err.println("Lookup-EGL: <"+glFuncName+"> 0x"+Long.toHexString(addr));
- }
- }
- if(0==addr) {
- addr = dynamicLookupFunctionOnLibs(glFuncName);
- }
- return addr;
- }
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java
new file mode 100755
index 000000000..aad25edc4
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLibraryBundleInfo.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sven Gothel nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.jogamp.opengl.impl.egl;
+
+import java.util.*;
+import com.jogamp.opengl.impl.*;
+
+public class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
+ static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+ glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
+ glueLibNames.add("jogl_es1");
+ }
+
+ protected EGLES1DynamicLibraryBundleInfo() {
+ super();
+ }
+
+ 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");
+ // for windows distributions using the 'unlike' lib prefix,
+ // where our tool does not add it.
+ 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;
+ }
+
+ public List/*<String>*/ getGlueLibNames() {
+ return glueLibNames;
+ }
+}
+
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java
deleted file mode 100755
index e5740a4f0..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.egl;
-
-import java.util.*;
-
-/**
- * Implementation of the EGLDynamicLookupHelper for ES1.
- */
-public class EGLES1DynamicLookupHelper extends EGLDynamicLookupHelper {
-
- protected EGLES1DynamicLookupHelper() {
- super();
- }
-
- protected int getESProfile() {
- return 1;
- }
-
- protected List/*<String>*/ getGLESLibNames() {
- List/*<String>*/ glesLibNames = new ArrayList();
-
- glesLibNames.add("GLES_CM");
- glesLibNames.add("GLES_CL");
- glesLibNames.add("GLESv1_CM");
- // for windows distributions using the 'unlike' lib prefix,
- // where our tool does not add it.
- glesLibNames.add("libGLES_CM");
- glesLibNames.add("libGLES_CL");
- glesLibNames.add("libGLESv1_CM");
-
- return glesLibNames;
- }
-}
-
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java
new file mode 100755
index 000000000..9691b2bd0
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLibraryBundleInfo.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sven Gothel nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.jogamp.opengl.impl.egl;
+
+import java.util.*;
+import com.jogamp.opengl.impl.*;
+
+public class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
+ static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+ glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
+ glueLibNames.add("jogl_es2");
+ }
+
+ protected EGLES2DynamicLibraryBundleInfo() {
+ super();
+ }
+
+ public List getToolLibNames() {
+ List/*<List>*/ libNames = new ArrayList();
+
+ List/*<String>*/ glesLibNames = new ArrayList();
+ glesLibNames.add("GLES20");
+ glesLibNames.add("GLESv2");
+ glesLibNames.add("GLESv2_CM");
+ // for windows distributions using the 'unlike' lib prefix
+ // where our tool does not add it.
+ 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;
+ }
+
+ 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/EGLES2DynamicLookupHelper.java
deleted file mode 100755
index c4fc66630..000000000
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.jogamp.opengl.impl.egl;
-
-import java.util.*;
-
-/**
- * Implementation of the EGLDynamicLookupHelper for ES2.
- */
-public class EGLES2DynamicLookupHelper extends EGLDynamicLookupHelper {
-
- protected EGLES2DynamicLookupHelper() {
- super();
- }
-
- protected int getESProfile() {
- return 2;
- }
-
- protected List/*<String>*/ getGLESLibNames() {
- List/*<String>*/ glesLibNames = new ArrayList();
-
- glesLibNames.add("GLES20");
- glesLibNames.add("GLESv2");
- glesLibNames.add("GLESv2_CM");
- // for windows distributions using the 'unlike' lib prefix
- // where our tool does not add it.
- glesLibNames.add("libGLES20");
- glesLibNames.add("libGLESv2");
- glesLibNames.add("libGLESv2_CM");
-
- return glesLibNames;
- }
-}
-
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);
}
}