aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun/opengl/impl/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/sun/opengl/impl/egl')
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java299
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java225
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java113
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java271
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java73
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java73
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java99
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java306
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java298
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java90
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java82
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java62
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java99
13 files changed, 0 insertions, 2090 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
deleted file mode 100755
index 3e67469b4..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
+++ /dev/null
@@ -1,299 +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.sun.opengl.impl.egl;
-
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
-
-public abstract class EGLContext extends GLContextImpl {
- private long eglContext;
- 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(GLDrawableImpl drawable, GLDrawableImpl drawableRead,
- GLContext shareWith) {
- super(drawable, drawableRead, shareWith);
- }
-
- public EGLContext(GLDrawableImpl drawable,
- GLContext shareWith) {
- this(drawable, null, shareWith);
- }
-
- 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;
- }
-
- protected String mapToRealGLFunctionName(String glFunctionName) {
- return glFunctionName;
- }
-
- protected String mapToRealGLExtensionName(String glExtensionName) {
- return glExtensionName;
- }
-
- public long getContext() {
- return eglContext;
- }
-
- protected int makeCurrentImpl() throws GLException {
- if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
- System.err.println("drawable not properly initialized");
- return CONTEXT_NOT_CURRENT;
- }
- boolean created = false;
- if (eglContext == 0) {
- create();
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created GL context 0x" +
- Long.toHexString(eglContext) + " for " + getClass().getName());
- }
- created = true;
- }
- if (EGL.eglGetCurrentContext() != eglContext) {
- if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
- ((EGLDrawable)drawable).getSurface(),
- ((EGLDrawable)drawableRead).getSurface(),
- eglContext)) {
- throw new GLException("Error making context 0x" +
- Long.toHexString(eglContext) + " current: error code " + EGL.eglGetError());
- }
- }
-
- if (created) {
- setGLFunctionAvailability(false);
- 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(eglContext) + ": error code " + EGL.eglGetError());
- }
- } finally {
- getDrawableImpl().getFactoryImpl().unlockToolkit();
- }
- }
-
- protected void destroyImpl() throws GLException {
- getDrawableImpl().getFactoryImpl().lockToolkit();
- try {
- if (eglContext != 0) {
- if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), eglContext)) {
- throw new GLException("Error destroying OpenGL context 0x" +
- Long.toHexString(eglContext) + ": error code " + EGL.eglGetError());
- }
- eglContext = 0;
- GLContextShareSet.contextDestroyed(this);
- }
- } finally {
- getDrawableImpl().getFactoryImpl().unlockToolkit();
- }
- }
-
- protected void create() throws GLException {
- long eglDisplay = ((EGLDrawable)drawable).getDisplay();
- EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
- GLProfile glProfile = drawable.getGLProfile();
- _EGLConfig eglConfig = config.getNativeConfig();
- long shareWith = EGL.EGL_NO_CONTEXT;
-
- if (eglDisplay == 0) {
- throw new GLException("Error: attempted to create an OpenGL context without a display connection");
- }
- if (eglConfig == null) {
- throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration");
- }
-
- try {
- // might be unavailable on EGL < 1.2
- if(!EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API)) {
- throw new GLException("eglBindAPI to ES failed , error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- } catch (GLException glex) {
- if (DEBUG) {
- glex.printStackTrace();
- }
- }
-
- EGLContext other = (EGLContext) GLContextShareSet.getShareContext(this);
- if (other != null) {
- shareWith = other.getContext();
- if (shareWith == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- }
-
- int[] contextAttrs = new int[] {
- EGL.EGL_CONTEXT_CLIENT_VERSION, -1,
- EGL.EGL_NONE
- };
- if (glProfile.usesNativeGLES2()) {
- contextAttrs[1] = 2;
- } else if (glProfile.usesNativeGLES1()) {
- contextAttrs[1] = 1;
- } else {
- throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile);
- }
- eglContext = EGL.eglCreateContext(eglDisplay, eglConfig, shareWith, contextAttrs, 0);
- if (eglContext == 0) {
- throw new GLException("Error creating OpenGL context: eglDisplay 0x"+Long.toHexString(eglDisplay)+
- ", "+glProfile+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- GLContextShareSet.contextCreated(this);
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created OpenGL context 0x" +
- Long.toHexString(eglContext) +
- ",\n\twrite surface 0x" + Long.toHexString(((EGLDrawable)drawable).getSurface()) +
- ",\n\tread surface 0x" + Long.toHexString(((EGLDrawable)drawableRead).getSurface())+
- ",\n\t"+this+
- ",\n\tsharing with 0x" + Long.toHexString(shareWith));
- }
- if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
- ((EGLDrawable)drawable).getSurface(),
- ((EGLDrawable)drawableRead).getSurface(),
- eglContext)) {
- throw new GLException("Error making context 0x" +
- Long.toHexString(eglContext) + " current: error code " + EGL.eglGetError());
- }
- setGLFunctionAvailability(true);
- }
-
- public boolean isCreated() {
- return (eglContext != 0);
- }
-
- protected void updateGLProcAddressTable() {
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Initializing EGL extension address table");
- }
- eglQueryStringInitialized = false;
- eglQueryStringAvailable = false;
-
- 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());
- super.updateGLProcAddressTable();
- }
-
- public synchronized String getPlatformExtensionsString() {
- if (!eglQueryStringInitialized) {
- eglQueryStringAvailable =
- getDrawableImpl().getDynamicLookupHelper().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 "";
- }
- }
-
- protected void setSwapIntervalImpl(int interval) {
- if (EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval)) {
- currentSwapInterval = interval ;
- }
- }
-
- public abstract void bindPbufferToTexture();
-
- public abstract void releasePbufferFromTexture();
-
- //----------------------------------------------------------------------
- // Currently unimplemented stuff
- //
-
- public void copy(GLContext source, int mask) throws GLException {
- throw new GLException("Not yet implemented");
- }
-
-
- public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
- throw new GLException("Should not call this");
- }
-
- public boolean offscreenImageNeedsVerticalFlip() {
- throw new GLException("Should not call this");
- }
-
- public int getOffscreenContextPixelDataType() {
- throw new GLException("Should not call this");
- }
-}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
deleted file mode 100755
index b0a5a93d6..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ /dev/null
@@ -1,225 +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.sun.opengl.impl.egl;
-
-import com.sun.opengl.impl.GLDrawableImpl;
-import com.sun.nativewindow.impl.NWReflection;
-import com.jogamp.gluegen.runtime.DynamicLookupHelper;
-
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import javax.media.opengl.*;
-
-public abstract class EGLDrawable extends GLDrawableImpl {
- protected boolean ownEGLDisplay = false; // for destruction
- protected boolean ownEGLSurface = false; // for destruction
- private EGLGraphicsConfiguration eglConfig;
- protected long eglDisplay;
- protected long eglSurface;
-
- protected EGLDrawable(EGLDrawableFactory factory,
- NativeWindow component) throws GLException {
- super(factory, component, false);
- eglSurface=EGL.EGL_NO_SURFACE;
- eglDisplay=0;
- }
-
- public long getDisplay() {
- return eglDisplay;
- }
-
- public long getSurface() {
- return eglSurface;
- }
-
- public EGLGraphicsConfiguration getGraphicsConfiguration() {
- return eglConfig;
- }
-
- public GLCapabilities getChosenGLCapabilities() {
- return (null==eglConfig)?super.getChosenGLCapabilities():(GLCapabilities)eglConfig.getChosenCapabilities();
- }
-
- public abstract GLContext createContext(GLContext shareWith);
-
- protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle);
-
- private void recreateSurface() {
- // create a new EGLSurface ..
- if(EGL.EGL_NO_SURFACE!=eglSurface) {
- EGL.eglDestroySurface(eglDisplay, eglSurface);
- }
-
- if(DEBUG) {
- System.err.println("createSurface using eglDisplay 0x"+Long.toHexString(eglDisplay)+", "+eglConfig);
- }
-
- 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.getSurfaceHandle())+" -> 0x"+Long.toHexString(eglSurface));
- }
- }
-
- 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);
- }
- 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();
- }
- } else {
- throw new GLException("EGLGraphicsDevice hold by non EGLGraphicsConfiguration: "+aConfig);
- }
- } 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
- }
- 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();
- }
- } else if (ownEGLSurface && eglSurface != EGL.EGL_NO_SURFACE) {
- // Destroy the window surface
- if (!EGL.eglDestroySurface(eglDisplay, eglSurface)) {
- throw new GLException("Error destroying window surface (eglDestroySurface)");
- }
- eglSurface = EGL.EGL_NO_SURFACE;
- if (ownEGLDisplay && EGL.EGL_NO_DISPLAY!=eglDisplay) {
- EGL.eglTerminate(eglDisplay);
- }
- eglDisplay=EGL.EGL_NO_DISPLAY;
- eglConfig=null;
- }
- }
-
- public int getWidth() {
- int[] tmp = new int[1];
- if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_WIDTH, tmp, 0)) {
- throw new GLException("Error querying surface width");
- }
- return tmp[0];
- }
-
- public int getHeight() {
- int[] tmp = new int[1];
- if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_HEIGHT, tmp, 0)) {
- throw new GLException("Error querying surface height");
- }
- return tmp[0];
- }
-
- public DynamicLookupHelper getDynamicLookupHelper() {
- return EGLDynamicLookupHelper.getDynamicLookupHelper(getGLProfile());
- }
-
- public String toString() {
- return getClass().getName()+"[realized "+getRealized()+
- ",\n\tfactory "+getFactory()+
- ",\n\twindow "+getNativeWindow()+
- ",\n\teglSurface 0x"+Long.toHexString(eglSurface)+
- ",\n\teglConfig "+eglConfig+
- ",\n\trequested "+getRequestedGLCapabilities()+
- ",\n\tchosen "+getChosenGLCapabilities()+"]";
- }
-}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
deleted file mode 100755
index 6b508c716..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ /dev/null
@@ -1,113 +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.sun.opengl.impl.egl;
-
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.jogamp.gluegen.runtime.NativeLibrary;
-
-public class EGLDrawableFactory extends GLDrawableFactoryImpl {
-
- static {
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- new EGLGraphicsConfigurationFactory();
-
- // Check for other underlying stuff ..
- if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) {
- try {
- NWReflection.createInstance("com.sun.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory");
- } catch (Throwable t) {}
- }
- }
-
- public EGLDrawableFactory() {
- super();
- }
-
- public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
- if (target == null) {
- throw new IllegalArgumentException("Null target");
- }
- return new EGLOnscreenDrawable(this, target);
- }
-
- protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
- throw new GLException("Not yet implemented");
- }
-
- public boolean canCreateGLPbuffer() {
- return true;
- }
-
- protected GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target) {
- return new EGLPbufferDrawable(this, target);
- }
-
- protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- NullWindow nw = new NullWindow(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(capabilities, chooser));
- nw.setSize(width, height);
- return nw;
- }
-
- public GLContext createExternalGLContext() {
- AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createScreenDevice(0);
- return new EGLExternalContext(absScreen);
- }
-
- public boolean canCreateExternalGLDrawable() {
- return false;
- }
-
- public GLDrawable createExternalGLDrawable() {
- throw new GLException("Not yet implemented");
- }
-
- public void loadGLULibrary() {
- }
-
- public boolean canCreateContextOnJava2DSurface() {
- return false;
- }
-
- public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
- throws GLException {
- throw new GLException("Unimplemented on this platform");
- }
-}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java
deleted file mode 100755
index 93c4b665f..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java
+++ /dev/null
@@ -1,271 +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.sun.opengl.impl.egl;
-
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.jogamp.gluegen.runtime.NativeLibrary;
-import com.jogamp.gluegen.runtime.DynamicLookupHelper;
-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.sun.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.sun.opengl.impl.Debug.isPropertyDefined("jogl.debug.DynamicLookup", true, localACC);
-
- EGLDynamicLookupHelper tmp=null;
- try {
- tmp = new EGLES1DynamicLookupHelper();
- } catch (Throwable t) {
- if(DEBUG) {
- t.printStackTrace();
- }
- }
- eglES1DynamicLookupHelper = tmp;
-
- tmp=null;
- try {
- tmp = new EGLES2DynamicLookupHelper();
- } catch (Throwable t) {
- if(DEBUG) {
- t.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) {
- NativeLibLoader.loadES2();
- } else if (esProfile==1) {
- NativeLibLoader.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.lookupFunction(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/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java
deleted file mode 100755
index 4968d0f88..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java
+++ /dev/null
@@ -1,73 +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.sun.opengl.impl.egl;
-
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.jogamp.gluegen.runtime.NativeLibrary;
-
-/**
- * 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/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java
deleted file mode 100755
index ce0edef6a..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java
+++ /dev/null
@@ -1,73 +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.sun.opengl.impl.egl;
-
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.jogamp.gluegen.runtime.NativeLibrary;
-
-/**
- * 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/sun/opengl/impl/egl/EGLExternalContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java
deleted file mode 100755
index 86c82396e..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java
+++ /dev/null
@@ -1,99 +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.sun.opengl.impl.egl;
-
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import javax.media.nativewindow.*;
-
-public class EGLExternalContext extends EGLContext {
- private boolean firstMakeCurrent = true;
- private boolean created = true;
- private GLContext lastContext;
-
- public EGLExternalContext(AbstractGraphicsScreen screen) {
- super(null, null);
- GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false);
- getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
- }
-
- public int makeCurrent() throws GLException {
- // Save last context if necessary to allow external GLContexts to
- // talk to other GLContexts created by this library
- GLContext cur = getCurrent();
- if (cur != null && cur != this) {
- lastContext = cur;
- setCurrent(null);
- }
- return super.makeCurrent();
- }
-
- public void release() throws GLException {
- super.release();
- setCurrent(lastContext);
- lastContext = null;
- }
-
- protected int makeCurrentImpl() throws GLException {
- if (firstMakeCurrent) {
- firstMakeCurrent = false;
- return CONTEXT_CURRENT_NEW;
- }
- return CONTEXT_CURRENT;
- }
-
- protected void releaseImpl() throws GLException {
- }
-
- protected void destroyImpl() throws GLException {
- created = false;
- GLContextShareSet.contextDestroyed(this);
- }
-
- public boolean isCreated() {
- return created;
- }
-
- public void bindPbufferToTexture() {
- throw new GLException("Should not call this");
- }
-
- public void releasePbufferFromTexture() {
- throw new GLException("Should not call this");
- }
-
-}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
deleted file mode 100644
index 84e4ab19d..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ /dev/null
@@ -1,306 +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.sun.opengl.impl.egl;
-
-import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.jogamp.gluegen.runtime.NativeLibrary;
-
-public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
- protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
-
- public _EGLConfig getNativeConfig() {
- return _config;
- }
-
- public int getNativeConfigID() {
- return configID;
- }
-
- public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
- GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
- _EGLConfig cfg, int cfgID) {
- super(absScreen, capsChosen, capsRequested);
- this.chooser = chooser;
- _config = cfg;
- configID = cfgID;
- }
-
- public static EGLGraphicsConfiguration create(GLCapabilities capsRequested, AbstractGraphicsScreen absScreen, int cfgID) {
- AbstractGraphicsDevice absDevice = absScreen.getDevice();
- if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
- throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
- }
- long dpy = absDevice.getHandle();
- if (dpy == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Invalid EGL display: "+absDevice);
- }
- GLProfile glp = capsRequested.getGLProfile();
- _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
- GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
- return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), _cfg, cfgID);
- }
-
- public Object clone() {
- return super.clone();
- }
-
- protected void updateGraphicsConfiguration() {
- EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration)
- GraphicsConfigurationFactory.getFactory(getScreen().getDevice()).chooseGraphicsConfiguration(getRequestedCapabilities(),
- chooser,
- getScreen());
- if(null!=newConfig) {
- // FIXME: setScreen( ... );
- setChosenCapabilities(newConfig.getChosenCapabilities());
- _config = newConfig.getNativeConfig();
- configID = newConfig.getNativeConfigID();
- if(DEBUG) {
- System.err.println("!!! updateGraphicsConfiguration: "+this);
- }
- }
- }
-
- public static _EGLConfig EGLConfigId2EGLConfig(GLProfile glp, long display, int configID) {
- int[] attrs = new int[] {
- EGL.EGL_CONFIG_ID, configID,
- EGL.EGL_NONE
- };
- _EGLConfig[] configs = new _EGLConfig[1];
- int[] numConfigs = new int[1];
- if (!EGL.eglChooseConfig(display,
- attrs, 0,
- configs, 1,
- numConfigs, 0)) {
- return null;
- }
- if (numConfigs[0] == 0) {
- return null;
- }
- return configs[0];
- }
-
- public static boolean EGLConfigDrawableTypeVerify(int val, boolean onscreen, boolean usePBuffer) {
- boolean res;
-
- if ( onscreen ) {
- res = ( 0 != (val & EGL.EGL_WINDOW_BIT) ) ;
- } else {
- res = ( 0 != (val & EGL.EGL_PIXMAP_BIT) ) || usePBuffer ;
- }
- if ( usePBuffer ) {
- res = res && ( 0 != (val & EGL.EGL_PBUFFER_BIT) ) ;
- }
-
- return res;
- }
-
- public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, _EGLConfig _config,
- boolean relaxed, boolean onscreen, boolean usePBuffer) {
- GLCapabilities caps = new GLCapabilities(glp);
- int[] val = new int[1];
-
- // Read the actual configuration into the choosen caps
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_RED_SIZE, val, 0)) {
- caps.setRedBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_GREEN_SIZE, val, 0)) {
- caps.setGreenBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_BLUE_SIZE, val, 0)) {
- caps.setBlueBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_ALPHA_SIZE, val, 0)) {
- caps.setAlphaBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_STENCIL_SIZE, val, 0)) {
- caps.setStencilBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_DEPTH_SIZE, val, 0)) {
- caps.setDepthBits(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_SAMPLES, val, 0)) {
- caps.setSampleBuffers(val[0]>0?true:false);
- caps.setNumSamples(val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_TYPE, val, 0)) {
- caps.setBackgroundOpaque(val[0] != EGL.EGL_TRANSPARENT_RGB);
- }
- if(!caps.isBackgroundOpaque()) {
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_RED_VALUE, val, 0)) {
- caps.setTransparentRedValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_GREEN_VALUE, val, 0)) {
- caps.setTransparentGreenValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val, 0)) {
- caps.setTransparentBlueValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
- }
- /** Not defined in EGL
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val, 0)) {
- caps.setTransparentAlphaValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
- } */
- }
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_SURFACE_TYPE, val, 0)) {
- if(EGLConfigDrawableTypeVerify(val[0], onscreen, usePBuffer)) {
- caps.setDoubleBuffered(onscreen);
- caps.setOnscreen(onscreen);
- caps.setPBuffer(usePBuffer);
- } else if(relaxed) {
- caps.setDoubleBuffered( 0 != (val[0] & EGL.EGL_WINDOW_BIT) );
- caps.setOnscreen( 0 != (val[0] & EGL.EGL_WINDOW_BIT) );
- caps.setPBuffer ( 0 != (val[0] & EGL.EGL_PBUFFER_BIT) );
- } else {
- throw new GLException("EGL_SURFACE_TYPE does not match !!!");
- }
- } else {
- if(relaxed) {
- if(DEBUG) {
- System.err.println("Could not determine EGL_SURFACE_TYPE !!!");
- }
- return null;
- } else {
- throw new GLException("Could not determine EGL_SURFACE_TYPE !!!");
- }
- }
-
- return caps;
- }
-
- public static int[] GLCapabilities2AttribList(GLCapabilities caps) {
- int[] attrs = new int[32];
- int idx=0;
-
- attrs[idx++] = EGL.EGL_SURFACE_TYPE;
- attrs[idx++] = caps.isOnscreen() ? ( EGL.EGL_WINDOW_BIT ) : ( caps.isPBuffer() ? EGL.EGL_PBUFFER_BIT : EGL.EGL_PIXMAP_BIT ) ;
-
- attrs[idx++] = EGL.EGL_RED_SIZE;
- attrs[idx++] = caps.getRedBits();
-
- attrs[idx++] = EGL.EGL_GREEN_SIZE;
- attrs[idx++] = caps.getGreenBits();
-
- attrs[idx++] = EGL.EGL_BLUE_SIZE;
- attrs[idx++] = caps.getBlueBits();
-
- attrs[idx++] = EGL.EGL_ALPHA_SIZE;
- attrs[idx++] = caps.getAlphaBits() > 0 ? caps.getAlphaBits() : EGL.EGL_DONT_CARE;
-
- attrs[idx++] = EGL.EGL_STENCIL_SIZE;
- attrs[idx++] = caps.getStencilBits() > 0 ? caps.getStencilBits() : EGL.EGL_DONT_CARE;
-
- attrs[idx++] = EGL.EGL_DEPTH_SIZE;
- attrs[idx++] = caps.getDepthBits();
-
- attrs[idx++] = EGL.EGL_SAMPLES;
- attrs[idx++] = caps.getSampleBuffers() ? caps.getNumSamples() : 1;
-
- attrs[idx++] = EGL.EGL_TRANSPARENT_TYPE;
- attrs[idx++] = caps.isBackgroundOpaque() ? EGL.EGL_NONE : EGL.EGL_TRANSPARENT_TYPE;
-
- // 20
-
- if(!caps.isBackgroundOpaque()) {
- attrs[idx++] = EGL.EGL_TRANSPARENT_RED_VALUE;
- attrs[idx++] = caps.getTransparentRedValue()>=0?caps.getTransparentRedValue():EGL.EGL_DONT_CARE;
-
- attrs[idx++] = EGL.EGL_TRANSPARENT_GREEN_VALUE;
- attrs[idx++] = caps.getTransparentGreenValue()>=0?caps.getTransparentGreenValue():EGL.EGL_DONT_CARE;
-
- attrs[idx++] = EGL.EGL_TRANSPARENT_BLUE_VALUE;
- attrs[idx++] = caps.getTransparentBlueValue()>=0?caps.getTransparentBlueValue():EGL.EGL_DONT_CARE;
-
- /** Not define in EGL
- attrs[idx++] = EGL.EGL_TRANSPARENT_ALPHA_VALUE;
- attrs[idx++] = caps.getTransparentAlphaValue()>=0?caps.getTransparentAlphaValue():EGL.EGL_DONT_CARE; */
- }
-
- // 26
-
- attrs[idx++] = EGL.EGL_RENDERABLE_TYPE;
- if(caps.getGLProfile().usesNativeGLES1()) {
- attrs[idx++] = EGL.EGL_OPENGL_ES_BIT;
- }
- else if(caps.getGLProfile().usesNativeGLES2()) {
- attrs[idx++] = EGL.EGL_OPENGL_ES2_BIT;
- } else {
- attrs[idx++] = EGL.EGL_OPENGL_BIT;
- }
-
- // 28
-
- attrs[idx++] = EGL.EGL_NONE;
-
- return attrs;
- }
-
- public static int[] CreatePBufferSurfaceAttribList(int width, int height, int texFormat) {
- int[] attrs = new int[16];
- int idx=0;
-
- attrs[idx++] = EGL.EGL_WIDTH;
- attrs[idx++] = width;
-
- attrs[idx++] = EGL.EGL_HEIGHT;
- attrs[idx++] = height;
-
- attrs[idx++] = EGL.EGL_TEXTURE_FORMAT;
- attrs[idx++] = texFormat;
-
- attrs[idx++] = EGL.EGL_TEXTURE_TARGET;
- attrs[idx++] = EGL.EGL_NO_TEXTURE==texFormat ? EGL.EGL_NO_TEXTURE : EGL.EGL_TEXTURE_2D;
-
- attrs[idx++] = EGL.EGL_NONE;
-
- return attrs;
- }
-
- public String toString() {
- return getClass().toString()+"["+getScreen()+", eglConfigID 0x"+Integer.toHexString(configID)+
- ",\n\trequested " + getRequestedCapabilities()+
- ",\n\tchosen " + getChosenCapabilities()+
- "]";
-
- }
-
- private GLCapabilitiesChooser chooser;
- private _EGLConfig _config;
- private int configID;
-}
-
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
deleted file mode 100644
index 3997850c0..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ /dev/null
@@ -1,298 +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.
- */
-
-package com.sun.opengl.impl.egl;
-
-import java.io.PrintStream;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import com.sun.nativewindow.impl.*;
-
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-
-/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
- are used on X11 platforms. Toolkits will likely need to delegate
- to this one to change the accepted and returned types of the
- GraphicsDevice and GraphicsConfiguration abstractions. */
-
-public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = GraphicsConfigurationFactory.DEBUG || com.sun.opengl.impl.Debug.debug("EGL");
-
- public EGLGraphicsConfigurationFactory() {
- // become the selector for KD/EGL ..
- GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.egl.EGLGraphicsDevice.class, this);
- }
-
- public AbstractGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities,
- CapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen) {
- if (absScreen == null) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only AbstractGraphicsDevice objects");
- }
-
- if (capabilities != null &&
- !(capabilities instanceof GLCapabilities)) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects");
- }
-
- if (chooser != null &&
- !(chooser instanceof GLCapabilitiesChooser)) {
- throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
- }
-
- return chooseGraphicsConfigurationStatic((GLCapabilities) capabilities,
- (GLCapabilitiesChooser) chooser,
- absScreen);
- }
-
- public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities capabilities,
- GLCapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen) {
- if (capabilities == null) {
- capabilities = new GLCapabilities(null);
- }
- GLProfile glp = capabilities.getGLProfile();
-
- if(null==absScreen) {
- throw new GLException("Null AbstractGraphicsScreen");
- }
- AbstractGraphicsDevice absDevice = absScreen.getDevice();
-
- if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
- throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
- }
- long eglDisplay = absDevice.getHandle();
-
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Invalid EGL display: "+absDevice);
- }
-
- GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
- if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER
- caps2.setDoubleBuffered(false);
- }
-
- EGLGraphicsConfiguration res = eglChooseConfig(eglDisplay, caps2, capabilities, chooser, absScreen);
- if(null!=res) {
- return res;
- }
- if(DEBUG) {
- System.err.println("eglChooseConfig failed with given capabilities "+caps2);
- }
-
- if (chooser == null) {
- chooser = new DefaultGLCapabilitiesChooser();
- }
-
- _EGLConfig[] configs = new _EGLConfig[10];
- int[] numConfigs = new int[1];
-
- if(!EGL.eglGetConfigs(eglDisplay, configs, configs.length, numConfigs, 0)) {
- throw new GLException("Graphics configuration fetch (eglGetConfigs) failed");
- }
- if (numConfigs[0] == 0) {
- throw new GLException("Graphics configuration fetch (eglGetConfigs) - no EGLConfig found");
- }
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
- caps2.isOnscreen(), caps2.isPBuffer());
- if(DEBUG) {
- System.err.println("EGL Get Configs: "+numConfigs[0]+", Caps "+caps.length);
- printCaps("eglGetConfigs", caps, System.err);
- }
- int chosen = -1;
- try {
- chosen = chooser.chooseCapabilities(caps2, caps, -1);
- } catch (NativeWindowException e) { throw new GLException(e); }
- if(chosen<0) {
- throw new GLException("Graphics configuration chooser failed");
- }
- if(DEBUG) {
- System.err.println("Chosen "+caps[chosen]);
- }
- res = eglChooseConfig(eglDisplay, caps[chosen], capabilities, chooser, absScreen);
- if(null!=res) {
- return res;
- }
- if(DEBUG) {
- System.err.println("eglChooseConfig failed with eglGetConfig/choosen capabilities "+caps[chosen]);
- }
-
- // Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..]
- //
- // rgb888 - d16, s4
- GLCapabilities fixedCaps = new GLCapabilities(glp);
- 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 (1): "+fixedCaps);
- }
- res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen);
- if(null!=res) {
- return res;
- }
-
- //
- // 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);
- if(null!=res) {
- return res;
- }
-
- //
- // rgb565 - d16, s4
- fixedCaps = new GLCapabilities(glp);
- fixedCaps.setRedBits(5);
- fixedCaps.setGreenBits(6);
- fixedCaps.setBlueBits(5);
- fixedCaps.setDepthBits(16);
- fixedCaps.setSampleBuffers(true);
- fixedCaps.setNumSamples(4);
- if(DEBUG) {
- System.err.println("trying fixed caps (3): "+fixedCaps);
- }
- res = eglChooseConfig(eglDisplay, fixedCaps, capabilities, chooser, absScreen);
- if(null!=res) {
- return res;
- }
- throw new GLException("Graphics configuration failed [direct caps, eglGetConfig/chooser and fixed-caps(1-3)]");
- }
-
- protected static EGLGraphicsConfiguration eglChooseConfig(long eglDisplay,
- GLCapabilities capsChosen0, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen) {
- GLProfile glp = capsChosen0.getGLProfile();
- int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen0);
- _EGLConfig[] configs = new _EGLConfig[1];
- int[] numConfigs = new int[1];
- if (!EGL.eglChooseConfig(eglDisplay,
- attrs, 0,
- configs, configs.length,
- numConfigs, 0)) {
- throw new GLException("Graphics configuration selection (eglChooseConfig) failed for "+capsChosen0);
- }
- if (numConfigs[0] > 0) {
- if(DEBUG) {
- GLCapabilities[] caps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0],
- capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
- System.err.println("EGL Choose Configs: "+numConfigs[0]+", Caps "+caps.length);
- printCaps("eglChooseConfig", caps, System.err);
- }
- int[] val = new int[1];
- // get the configID
- if(!EGL.eglGetConfigAttrib(eglDisplay, configs[0], EGL.EGL_CONFIG_ID, val, 0)) {
- if(DEBUG) {
- // FIXME: this happens on a ATI PC Emulation ..
- System.err.println("EGL couldn't retrieve ConfigID for already chosen eglConfig "+capsChosen0+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- }
- return null;
- }
- GLCapabilities capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0],
- true, capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
- if(null!=capsChosen1) {
- if(DEBUG) {
- System.err.println("eglChooseConfig found: eglDisplay 0x"+Long.toHexString(eglDisplay)+
- ", eglConfig ID 0x"+Integer.toHexString(val[0])+
- ", "+capsChosen0+" -> "+capsChosen1);
- }
- return new EGLGraphicsConfiguration(absScreen, capsChosen1, capsRequested, chooser, configs[0], val[0]);
- }
- if(DEBUG) {
- System.err.println("eglChooseConfig couldn't verify: eglDisplay 0x"+Long.toHexString(eglDisplay)+
- ", eglConfig ID 0x"+Integer.toHexString(val[0])+
- ", for "+capsChosen0);
- }
- } else {
- if(DEBUG) {
- System.err.println("EGL Choose Configs: None using eglDisplay 0x"+Long.toHexString(eglDisplay)+
- ", "+capsChosen0);
- }
- }
- return null;
- }
-
- protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, _EGLConfig[] configs, int num,
- boolean onscreen, boolean usePBuffer) {
- GLCapabilities[] caps = new GLCapabilities[num];
- for(int i=0; i<num; i++) {
- caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[i],
- true, onscreen, usePBuffer);
- }
- return caps;
- }
-
- protected static void printCaps(String prefix, GLCapabilities[] caps, PrintStream out) {
- for(int i=0; i<caps.length; i++) {
- out.println(prefix+"["+i+"] "+caps[i]);
- }
- }
-
- protected static EGLGraphicsConfiguration createOffscreenGraphicsConfiguration(GLCapabilities caps, GLCapabilitiesChooser chooser) {
- if(caps.isOnscreen()) {
- throw new GLException("Error: Onscreen set: "+caps);
- }
- caps.setDoubleBuffered(false); // FIXME
- long eglDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
- if (eglDisplay == EGL.EGL_NO_DISPLAY) {
- throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
- } else if(DEBUG) {
- System.err.println("eglDisplay(EGL_DEFAULT_DISPLAY): 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, 0);
- EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(caps, chooser, s);
- if (null == eglConfig) {
- EGL.eglTerminate(eglDisplay);
- throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
- } else if(DEBUG) {
- System.err.println("Chosen eglConfig: "+eglConfig);
- }
- return eglConfig;
- }
-}
-
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
deleted file mode 100755
index 957b7b7fe..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
+++ /dev/null
@@ -1,90 +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.sun.opengl.impl.egl;
-
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
-
-public class EGLOnscreenContext extends EGLContext {
- public EGLOnscreenContext(EGLOnscreenDrawable drawable, GLContext shareWith) {
- 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");
- }
-
- public void releasePbufferFromTexture() {
- throw new GLException("Should not call this");
- }
-
-}
-
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
deleted file mode 100644
index 45fffbc91..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2003 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.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.opengl.impl.egl;
-
-import javax.media.opengl.*;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
-
-public class EGLOnscreenDrawable extends EGLDrawable {
- protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException {
- super(factory, component);
- }
-
- public GLContext createContext(GLContext shareWith) {
- return new EGLOnscreenContext(this, shareWith);
- }
-
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
- return EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, surfaceHandle, null);
- }
-
- protected void swapBuffersImpl() {
- boolean didLock = false;
- try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
- }
-
- EGL.eglSwapBuffers(eglDisplay, eglSurface);
-
- } finally {
- if(didLock) {
- unlockSurface();
- }
- }
- }
-
-}
-
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java
deleted file mode 100755
index 085f9c4b9..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java
+++ /dev/null
@@ -1,62 +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.sun.opengl.impl.egl;
-
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
-
-public class EGLPbufferContext extends EGLContext {
- public EGLPbufferContext(EGLPbufferDrawable drawable, GLContext shareWith) {
- super(drawable, shareWith);
- }
-
- public int getFloatingPointMode() {
- return 0; // FIXME ??
- }
-
- public void bindPbufferToTexture() {
- throw new GLException("Not yet implemented");
- }
-
- public void releasePbufferFromTexture() {
- throw new GLException("Not yet implemented");
- }
-}
-
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
deleted file mode 100644
index e16420b3a..000000000
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2003 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.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.opengl.impl.egl;
-
-import javax.media.opengl.*;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
-import com.sun.opengl.impl.*;
-
-public class EGLPbufferDrawable extends EGLDrawable {
- private int texFormat;
- protected static final boolean useTexture = false; // No yet ..
-
- protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeWindow target) {
- super(factory, target);
- ownEGLDisplay = true;
-
- // get choosen ones ..
- GLCapabilities caps = (GLCapabilities) getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
-
- if(useTexture) {
- this.texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB ;
- } else {
- this.texFormat = EGL.EGL_NO_TEXTURE;
- }
-
- if (DEBUG) {
- System.out.println("Pbuffer config: " + getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration());
- }
-
- setRealized(true);
-
- if (DEBUG) {
- System.out.println("Created pbuffer: " + this);
- }
-
- }
-
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
- NativeWindow nw = getNativeWindow();
- int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat);
- long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0);
- if (EGL.EGL_NO_SURFACE==surf) {
- throw new GLException("Creation of window surface (eglCreatePbufferSurface) failed, dim "+nw.getWidth()+"x"+nw.getHeight()+", error 0x"+Integer.toHexString(EGL.eglGetError()));
- } else if(DEBUG) {
- System.err.println("PBuffer setSurface result: eglSurface 0x"+Long.toHexString(surf));
- }
- ((SurfaceChangeable)nw).setSurfaceHandle(surf);
- return surf;
- }
-
- public GLContext createContext(GLContext shareWith) {
- return new EGLPbufferContext(this, shareWith);
- }
-
- protected void swapBuffersImpl() {
- if(DEBUG) {
- System.err.println("unhandled swapBuffersImpl() called for: "+this);
- }
- }
-}
-