aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java13
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java12
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java25
-rw-r--r--src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java102
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java25
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java93
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java45
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java2
26 files changed, 296 insertions, 164 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
index 5655d1a7a..08c755cd3 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
@@ -59,9 +59,13 @@ public class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
}
/** Tool has none **/
- public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return 0;
}
+
+ public boolean useToolGetProcAdressFirst(String funcName) {
+ return false;
+ }
public List/*<List<String>>*/ getToolLibNames() {
List/*<List>*/ libNamesList = new ArrayList();
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 766533aab..0bf4abab6 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -41,6 +41,8 @@
package javax.media.opengl;
import java.nio.IntBuffer;
+import java.security.AccessControlContext;
+import java.security.AccessController;
import java.util.HashMap;
import java.util.HashSet;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -63,10 +65,17 @@ import jogamp.opengl.GLContextImpl;
abstraction provides a stable object which clients can use to
refer to a given context. */
public abstract class GLContext {
+
/** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */
- public final static boolean DEBUG_GL = Debug.debug("DebugGL");
+ public final static boolean DEBUG_GL;
/** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */
- public final static boolean TRACE_GL = Debug.debug("TraceGL");
+ public final static boolean TRACE_GL;
+
+ static {
+ final AccessControlContext acl = AccessController.getContext();
+ DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true, acl);
+ TRACE_GL = Debug.isPropertyDefined("jogl.debug.TraceGL", true, acl);
+ }
/** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */
public static final int CONTEXT_NOT_CURRENT = 0;
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 5fc977581..1340b661d 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -260,19 +260,17 @@ public abstract class GLDrawableFactory {
}
/**
- * Returns true if a shared context is already mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()},
- * or if a new shared context could be created and mapped. Otherwise return false.<br>
- * Creation of the shared context is tried only once.
+ * Returns true if a shared context could be created while initialization
+ * of shared resources for <code>device</code> {@link AbstractGraphicsDevice#getConnection()}.<br>
+ * This does not imply a shared context is mapped, but was available<br>.
*
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
*/
- public final boolean getIsSharedContextAvailable(AbstractGraphicsDevice device) {
- return null != getOrCreateSharedContext(device);
- }
+ public abstract boolean getWasSharedContextCreated(AbstractGraphicsDevice device);
/**
* Returns the shared context mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()},
- * either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br>
+ * either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br>
* Creation of the shared context is tried only once.
*
* @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index f5f2e5389..0f502ce32 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1202,7 +1202,7 @@ public class GLProfile {
if(null != desktopFactory) {
DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0);
if(null!=glLookupHelper) {
- hasDesktopGLFactory = glLookupHelper.hasGLBinding();
+ hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl;
}
}
} catch (LinkageError le) {
@@ -1279,7 +1279,7 @@ public class GLProfile {
final boolean addedAnyProfile = addedDesktopProfile || addedEGLProfile ;
if(DEBUG) {
- System.err.println("GLProfile.init addedAnyProfile(e/d) "+addedAnyProfile+" ("+addedDesktopProfile+"/"+addedEGLProfile+")");
+ System.err.println("GLProfile.init addedAnyProfile(d/e) "+addedAnyProfile+" ("+addedDesktopProfile+"/"+addedEGLProfile+")");
System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable);
System.err.println("GLProfile.init hasDesktopGLFactory "+hasDesktopGLFactory);
System.err.println("GLProfile.init hasGL234Impl "+hasGL234Impl);
@@ -1324,14 +1324,16 @@ public class GLProfile {
boolean addedDesktopProfile = false;
boolean addedEGLProfile = false;
-
- if( hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device)) {
+ boolean deviceIsDesktopCompatible = false;
+ boolean deviceIsEGLCompatible = false;
+
+ if( hasDesktopGLFactory && ( deviceIsDesktopCompatible = desktopFactory.getIsDeviceCompatible(device)) ) {
// 1st pretend we have all Desktop and EGL profiles ..
computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */);
// Triggers eager initialization of share context in GLDrawableFactory for the device,
// hence querying all available GLProfiles
- boolean desktopSharedCtxAvail = desktopFactory.getIsSharedContextAvailable(device);
+ boolean desktopSharedCtxAvail = desktopFactory.getWasSharedContextCreated(device);
if (DEBUG) {
System.err.println("GLProfile.initProfilesForDevice: "+device+": desktop Shared Ctx "+desktopSharedCtxAvail);
}
@@ -1343,13 +1345,14 @@ public class GLProfile {
1, 5, GLContext.CTX_PROFILE_COMPAT|GLContext.CTX_OPTION_ANY);
}
addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */);
- } else if( null!=eglFactory && ( hasGLES2Impl || hasGLES1Impl ) && eglFactory.getIsDeviceCompatible(device)) {
+ } else if( hasEGLFactory && ( hasGLES2Impl || hasGLES1Impl ) &&
+ ( deviceIsEGLCompatible = eglFactory.getIsDeviceCompatible(device)) ) {
// 1st pretend we have all EGL profiles ..
computeProfileMap(device, false /* desktopCtxUndef*/, true /* esCtxUndef */);
// Triggers eager initialization of share context in GLDrawableFactory for the device,
// hence querying all available GLProfiles
- boolean eglSharedCtxAvail = eglFactory.getIsSharedContextAvailable(device);
+ boolean eglSharedCtxAvail = eglFactory.getWasSharedContextCreated(device);
if (DEBUG) {
System.err.println("GLProfile.initProfilesForDevice: "+device+": egl Shared Ctx "+eglSharedCtxAvail);
}
@@ -1371,7 +1374,13 @@ public class GLProfile {
} else {
setProfileMap(device, new HashMap()); // empty
if(DEBUG) {
- System.err.println("GLProfile: EGLFactory - Device is not available: "+device);
+ System.err.println("GLProfile: device could not be initialized: "+device);
+ System.err.println("GLProfile: compatible w/ desktop: "+deviceIsDesktopCompatible+
+ ", egl "+deviceIsEGLCompatible);
+ System.err.println("GLProfile: desktoplFactory "+desktopFactory);
+ System.err.println("GLProfile: eglFactory "+eglFactory);
+ System.err.println("GLProfile: hasGLES1Impl "+hasGLES1Impl);
+ System.err.println("GLProfile: hasGLES2Impl "+hasGLES2Impl);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
index dc33541e6..1b8c3c1e5 100644
--- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
@@ -32,21 +32,14 @@ import java.util.List;
import java.util.ArrayList;
public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo {
- private static int posGlueLibGLDESKTOP;
private static List/*<String>*/ glueLibNames;
static {
glueLibNames = new ArrayList();
glueLibNames.addAll(getGlueLibNamesPreload());
-
- posGlueLibGLDESKTOP = glueLibNames.size();
glueLibNames.add("jogl_desktop");
}
- public static final int getGlueLibPosGLDESKTOP() {
- return posGlueLibGLDESKTOP;
- }
-
public DesktopGLDynamicLibraryBundleInfo() {
super();
}
@@ -54,5 +47,10 @@ public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibrary
public final List/*<String>*/ getGlueLibNames() {
return glueLibNames;
}
+
+ public boolean useToolGetProcAdressFirst(String funcName) {
+ return true;
+ }
+
}
diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
index 4879c617e..2d2d1c536 100644
--- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
+++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
@@ -39,10 +39,6 @@ public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper {
public DesktopGLDynamicLibraryBundleInfo getDesktopGLBundleInfo() { return (DesktopGLDynamicLibraryBundleInfo) getBundleInfo(); }
- public boolean hasGLBinding() {
- return isToolLibLoaded() && isGlueLibLoaded(DesktopGLDynamicLibraryBundleInfo.getGlueLibPosGLDESKTOP());
- }
-
public synchronized boolean loadGLULibrary() {
/** hacky code .. where all platform GLU libs are tried ..*/
if(null==gluLib) {
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index b5223a5b6..971b32d47 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -173,14 +173,16 @@ final class ExtensionAvailabilityCache {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: ALL EXTENSIONS: "+availableExtensionCache.size());
}
- int major[] = new int[] { context.getGLVersionMajor() };
- int minor[] = new int[] { context.getGLVersionMinor() };
- while (GLContext.isValidGLVersion(major[0], minor[0])) {
- availableExtensionCache.add("GL_VERSION_" + major[0] + "_" + minor[0]);
- if (DEBUG) {
- System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Added GL_VERSION_" + major[0] + "_" + minor[0] + " to known extensions");
- }
- if(!GLContext.decrementGLVersion(major, minor)) break;
+ if(!context.isGLES()) {
+ int major[] = new int[] { context.getGLVersionMajor() };
+ int minor[] = new int[] { context.getGLVersionMinor() };
+ while (GLContext.isValidGLVersion(major[0], minor[0])) {
+ availableExtensionCache.add("GL_VERSION_" + major[0] + "_" + minor[0]);
+ if (DEBUG) {
+ System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Added GL_VERSION_" + major[0] + "_" + minor[0] + " to known extensions");
+ }
+ if(!GLContext.decrementGLVersion(major, minor)) break;
+ }
}
// put a dummy var in here so that the cache is no longer empty even if
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
index dc121323e..78ab7cc93 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
@@ -95,8 +95,7 @@ public class GLBufferSizeTracker {
// pattern of buffer objects indicates that the fact that this map
// never shrinks is probably not that bad.
private IntLongHashMap bufferSizeMap;
-
- protected static final boolean DEBUG = Debug.debug("GLStatusTracker");
+ protected static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferSizeTracker", true);
public GLBufferSizeTracker() {
bufferSizeMap = new IntLongHashMap();
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
index 1e5dc6069..92e27cbd4 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
@@ -76,8 +76,7 @@ import com.jogamp.common.util.IntIntHashMap;
*/
public class GLBufferStateTracker {
- protected static final boolean DEBUG = GLBufferSizeTracker.DEBUG;
-
+ protected static final boolean DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferStateTracker", true);
// Maps binding targets to buffer objects. A null value indicates
// that the binding is unknown. A zero value indicates that it is
// known that no buffer is bound to the target, according to the
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index 066ea8120..19a664071 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -138,6 +138,7 @@ public class GLGraphicsConfigurationUtil {
// fix caps ..
GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
+ caps2.setOnscreen(false);
caps2.setPBuffer(true);
return caps2;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 07cf512f8..49b3556c0 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -172,7 +172,7 @@ public abstract class EGLContext extends GLContextImpl {
contextHandle = EGL.eglCreateContext(eglDisplay, eglConfig, shareWith, contextAttrs, 0);
if (contextHandle == 0) {
throw new GLException("Error creating OpenGL context: eglDisplay "+toHexString(eglDisplay)+
- ", eglConfig "+toHexString(eglConfig)+", "+glProfile+", error "+toHexString(EGL.eglGetError()));
+ ", eglConfig "+config+", "+glProfile+", shareWith "+toHexString(shareWith)+", error "+toHexString(EGL.eglGetError()));
}
GLContextShareSet.contextCreated(this);
if (DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index 3cc273966..a9cc40335 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -103,7 +103,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
AbstractGraphicsDevice aDevice = aConfig.getScreen().getDevice();
if(aDevice instanceof EGLGraphicsDevice) {
if(DEBUG) {
- System.err.println("EGLDrawable.setRealized: using existing EGL config - START");
+ System.err.println("EGLDrawable.setRealized(true): using existing EGL config - START");
}
// just fetch the data .. trust but verify ..
eglDisplay = aDevice.getHandle();
@@ -127,20 +127,14 @@ public abstract class EGLDrawable extends GLDrawableImpl {
} else {
// EGLSurface is ours ..
ownEGLSurface=true;
-
- eglConfig.updateGraphicsConfiguration();
-
recreateSurface();
}
} else {
throw new GLException("EGLGraphicsDevice hold by non EGLGraphicsConfiguration: "+aConfig);
}
- if(DEBUG) {
- System.err.println("EGLDrawable.setRealized: using existing EGL config - END: "+this);
- }
} else {
if(DEBUG) {
- System.err.println("EGLDrawable.setRealized: creating new EGL config - START");
+ System.err.println("EGLDrawable.setRealized(true): creating new EGL config - START");
}
// create a new EGL config ..
ownEGLDisplay=true;
@@ -182,11 +176,14 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println("Chosen eglConfig: "+eglConfig);
}
recreateSurface();
- if(DEBUG) {
- System.err.println("EGLDrawable.setRealized: creating new EGL config - END: "+this);
- }
+ }
+ if(DEBUG) {
+ System.err.println("EGLDrawable.setRealized(true): END: ownDisplay "+ownEGLDisplay+", ownSurface "+ownEGLSurface+" - "+this);
}
} else if (ownEGLSurface && eglSurface != EGL.EGL_NO_SURFACE) {
+ if(DEBUG) {
+ System.err.println("EGLDrawable.setRealized(false): ownDisplay "+ownEGLDisplay+", ownSurface "+ownEGLSurface);
+ }
// Destroy the window surface
if (!EGL.eglDestroySurface(eglDisplay, eglSurface)) {
throw new GLException("Error destroying window surface (eglDestroySurface)");
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 45d286da3..e0283abd7 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -42,6 +42,7 @@ import javax.media.opengl.*;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
+
import jogamp.opengl.*;
import jogamp.nativewindow.WrappedSurface;
@@ -102,15 +103,27 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
static class SharedResource {
private EGLGraphicsDevice device;
- //private EGLDrawable drawable;
- //private EGLContext context;
-
- SharedResource(EGLGraphicsDevice dev /*, EGLDrawable draw, EGLContext ctx */) {
+ // private EGLDrawable drawable;
+ // private EGLContext contextES1;
+ // private EGLContext contextES2;
+ private boolean wasES1ContextCreated;
+ private boolean wasES2ContextCreated;
+
+ SharedResource(EGLGraphicsDevice dev, boolean wasContextES1Created, boolean wasContextES2Created
+ /*EGLDrawable draw, EGLContext ctxES1, EGLContext ctxES2 */) {
device = dev;
// drawable = draw;
- // context = ctx;
+ // contextES1 = ctxES1;
+ // contextES2 = ctxES2;
+ this.wasES1ContextCreated = wasContextES1Created;
+ this.wasES2ContextCreated = wasContextES2Created;
}
- EGLGraphicsDevice getDevice() { return device; }
+ final EGLGraphicsDevice getDevice() { return device; }
+ // final EGLDrawable getDrawable() { return drawable; }
+ // final EGLContext getContextES1() { return contextES1; }
+ // final EGLContext getContextES2() { return contextES2; }
+ final boolean wasES1ContextAvailable() { return wasES1ContextCreated; }
+ final boolean wasES2ContextAvailable() { return wasES2ContextCreated; }
}
HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap();
EGLGraphicsDevice defaultDevice;
@@ -123,40 +136,81 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return true; // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
}
- private SharedResource getOrCreateShared(AbstractGraphicsDevice device) {
- String connection = device.getConnection();
+ private boolean isEGLContextAvailable(EGLGraphicsDevice sharedDevice, String profile) {
+ boolean madeCurrent = false;
+ final GLCapabilities caps = new GLCapabilities(GLProfile.get(profile));
+ caps.setRedBits(5); caps.setGreenBits(5); caps.setBlueBits(5); caps.setAlphaBits(0);
+ caps.setDoubleBuffered(false);
+ caps.setOnscreen(false);
+ caps.setPBuffer(true);
+ final EGLDrawable drawable = (EGLDrawable) createGLDrawable( createOffscreenSurfaceImpl(sharedDevice, caps, caps, null, 64, 64) );
+ if(null!=drawable) {
+ final EGLContext context = (EGLContext) drawable.createContext(null);
+ if (null != context) {
+ context.setSynchronized(true);
+ try {
+ context.makeCurrent(); // could cause exception
+ madeCurrent = context.isCurrent();
+ } catch (GLException gle) {
+ if (DEBUG) {
+ System.err.println("EGLDrawableFactory.createShared: INFO: makeCurrent failed");
+ gle.printStackTrace();
+ }
+ } finally {
+ context.destroy();
+ }
+ }
+ drawable.destroy();
+ }
+ return madeCurrent;
+ }
+
+ private SharedResource getOrCreateShared(AbstractGraphicsDevice adevice) {
+ String connection = adevice.getConnection();
SharedResource sr;
synchronized(sharedMap) {
sr = (SharedResource) sharedMap.get(connection);
}
- if(null==sr) {
+ if(null==sr) {
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));
+ System.err.println("EGLDrawableFactory.createShared: 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 sharedDevice = new EGLGraphicsDevice(eglDisplay, connection, device.getUnitID());
- sr = new SharedResource(sharedDevice);
+ final EGLGraphicsDevice sharedDevice = new EGLGraphicsDevice(eglDisplay, connection, adevice.getUnitID());
+ // final boolean madeCurrentES1 = isEGLContextAvailable(sharedDevice, GLProfile.GLES1);
+ // final boolean madeCurrentES2 = isEGLContextAvailable(sharedDevice, GLProfile.GLES2);
+ final boolean madeCurrentES1 = true; // FIXME
+ final boolean madeCurrentES2 = true; // FIXME
+ sr = new SharedResource(sharedDevice, madeCurrentES1, madeCurrentES2);
synchronized(sharedMap) {
sharedMap.put(connection, sr);
}
if (DEBUG) {
- System.err.println("!!! SharedDevice: "+sharedDevice);
- }
+ System.err.println("EGLDrawableFactory.createShared: device: " + sharedDevice);
+ System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1);
+ System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2);
+ }
}
return sr;
}
-
+ public final boolean getWasSharedContextCreated(AbstractGraphicsDevice device) {
+ SharedResource sr = getOrCreateShared(device);
+ if(null!=sr) {
+ return sr.wasES1ContextAvailable() || sr.wasES2ContextAvailable();
+ }
+ return false;
+ }
+
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
- // FIXME: not implemented .. needs a dummy EGL surface - NEEDED ?
- return null;
+ return null; // n/a for EGL .. since we don't keep the resources
}
-
+
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
SharedResource sr = getOrCreateShared(device);
if(null!=sr) {
@@ -205,7 +259,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
if(!caps.isPBuffer()) {
- throw new GLException("Not yet implemented");
+ throw new GLException("Non pbuffer not yet implemented");
}
// PBuffer GLDrawable Creation
return new EGLPbufferDrawable(this, target);
@@ -221,10 +275,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return ns;
}
- protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice device, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
- WrappedSurface ns = new WrappedSurface(EGLGraphicsConfigurationFactory.createOffscreenGraphicsConfiguration(device, capsRequested, capsRequested, chooser), windowHandle);
+ protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice adevice, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
+ // FIXME device/windowHandle -> screen ?!
+ EGLGraphicsDevice device = (EGLGraphicsDevice) adevice;
+ DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
+ EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen);
+ WrappedSurface ns = new WrappedSurface(cfg, windowHandle);
return ns;
- }
+ }
protected GLContext createExternalGLContextImpl() {
AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
index 6fd3ecf1c..4182c4666 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
@@ -30,10 +30,14 @@ package jogamp.opengl.egl;
import com.jogamp.common.os.DynamicLookupHelper;
import com.jogamp.common.os.NativeLibrary;
+import com.jogamp.common.os.Platform;
+
import java.util.*;
+
import javax.media.nativewindow.*;
import javax.media.opengl.*;
import jogamp.opengl.*;
+
import java.security.*;
/**
@@ -43,6 +47,12 @@ import java.security.*;
* Currently two implementations exist, one for ES1 and one for ES2.
*/
public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo {
+ static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+ glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
+ glueLibNames.add("jogl_mobile");
+ }
protected EGLDynamicLibraryBundleInfo() {
super();
@@ -50,21 +60,30 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
/** Might be a desktop GL library, and might need to allow symbol access to subsequent libs */
public boolean shallLinkGlobal() { return true; }
+
+ public boolean shallLookupGlobal() { return true; }
+
public final List getToolGetProcAddressFuncNameList() {
List res = new ArrayList();
res.add("eglGetProcAddress");
return res;
}
- public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
}
+ public final boolean useToolGetProcAdressFirst(String funcName) {
+ return false; // JAU / FIXME funcName.startsWith("egl");
+ }
+
protected List/*<String>*/ getEGLLibNamesList() {
List/*<String>*/ eglLibNames = new ArrayList();
+
// try default generic names first
eglLibNames.add("EGL");
+
// for windows distributions using the 'unlike' lib prefix,
// where our tool does not add it.
eglLibNames.add("libEGL");
@@ -72,4 +91,8 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
eglLibNames.add("libEGL.so.1");
return eglLibNames;
}
+
+ public final List/*<String>*/ getGlueLibNames() {
+ return glueLibNames;
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
index 13da8d3d4..4c38a29b1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
@@ -29,16 +29,12 @@
package jogamp.opengl.egl;
import java.util.*;
+
+import com.jogamp.common.os.Platform;
+
import jogamp.opengl.*;
public class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
- static List/*<String>*/ glueLibNames;
- static {
- glueLibNames = new ArrayList();
- glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
- glueLibNames.add("jogl_es1");
- }
-
protected EGLES1DynamicLibraryBundleInfo() {
super();
}
@@ -47,6 +43,7 @@ public class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo
List/*<List>*/ libNames = new ArrayList();
List/*<String>*/ glesLibNames = new ArrayList();
+
// try default generic names first
glesLibNames.add("GLES_CM");
glesLibNames.add("GLES_CL");
@@ -63,9 +60,5 @@ public class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo
libNames.add(getEGLLibNamesList());
return libNames;
}
-
- public List/*<String>*/ getGlueLibNames() {
- return glueLibNames;
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
index 361f0148e..7943e1946 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
@@ -29,16 +29,12 @@
package jogamp.opengl.egl;
import java.util.*;
+
+import com.jogamp.common.os.Platform;
+
import jogamp.opengl.*;
public class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
- static List/*<String>*/ glueLibNames;
- static {
- glueLibNames = new ArrayList();
- glueLibNames.addAll(GLDynamicLibraryBundleInfo.getGlueLibNamesPreload());
- glueLibNames.add("jogl_es2");
- }
-
protected EGLES2DynamicLibraryBundleInfo() {
super();
}
@@ -47,6 +43,7 @@ public class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo
List/*<List>*/ libNames = new ArrayList();
List/*<String>*/ glesLibNames = new ArrayList();
+
// try default generic names first
glesLibNames.add("GLES20");
glesLibNames.add("GLESv2");
@@ -63,9 +60,5 @@ public class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo
libNames.add(getEGLLibNamesList());
return libNames;
}
-
- public List/*<String>*/ getGlueLibNames() {
- return glueLibNames;
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index 6c4901de8..ab332e659 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -37,7 +37,8 @@ public class EGLGLCapabilities extends GLCapabilities {
final long eglcfg;
final int eglcfgid;
final int renderableType;
-
+ int nativeVisualID;
+
/** Comparing EGLConfig ID only */
public static class EglCfgIDComparator implements Comparator {
@@ -101,6 +102,8 @@ public class EGLGLCapabilities extends GLCapabilities {
final public long getEGLConfig() { return eglcfg; }
final public int getEGLConfigID() { return eglcfgid; }
final public int getRenderableType() { return renderableType; }
+ final public void setNativeVisualID(int vid) { nativeVisualID=vid; }
+ final public int getNativeVisualID() { return nativeVisualID; }
public static boolean isCompatible(GLProfile glp, int renderableType) {
if(null == glp) {
@@ -155,8 +158,9 @@ public class EGLGLCapabilities extends GLCapabilities {
if(null == sink) {
sink = new StringBuffer();
}
- sink.append("0x").append(Long.toHexString(eglcfg)).append(", ");
+ // sink.append("0x").append(Long.toHexString(eglcfg)).append(", ");
sink.append("0x").append(Long.toHexString(eglcfgid)).append(": ");
+ sink.append("vid 0x").append(Integer.toHexString(nativeVisualID)).append(", ");
super.toString(sink);
sink.append(", [");
renderableTypeToString(sink, renderableType);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 8de590879..1eda2fb7a 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -36,10 +36,13 @@
package jogamp.opengl.egl;
+import java.nio.IntBuffer;
import java.util.ArrayList;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
import javax.media.opengl.*;
+
+import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
import jogamp.opengl.*;
@@ -149,80 +152,100 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
GLProfile glp, long display, long config,
int winattrmask) {
final int allDrawableTypeBits = EGLConfigDrawableTypeBits(display, config);
- final int drawableTypeBits = winattrmask & allDrawableTypeBits;
+ int drawableTypeBits = winattrmask & allDrawableTypeBits;
if( 0 == drawableTypeBits ) {
return false;
}
- int[] val = new int[1];
-
+ final IntBuffer val = Buffers.newDirectIntBuffer(1);
+ int cfgID;
+ int rType;
+
// get the configID
- if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val, 0)) {
+ if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
if(DEBUG) {
// FIXME: this happens on a ATI PC Emulation ..
System.err.println("EGL couldn't retrieve ConfigID for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError()));
}
return false;
}
+ cfgID = val.get(0);
- if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val, 0)) {
+ if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val)) {
if(DEBUG) {
System.err.println("EGL couldn't retrieve EGL_RENDERABLE_TYPE for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError()));
}
return false;
}
+ rType = val.get(0);
+
EGLGLCapabilities caps = null;
try {
- caps = new EGLGLCapabilities(config, val[0], glp, val[0]);
+ caps = new EGLGLCapabilities(config, cfgID, glp, rType);
} catch (GLException gle) {
if(DEBUG) {
System.err.println("config "+toHexString(config)+": "+gle);
}
return false;
- }
-
+ }
+
// Read the actual configuration into the chosen caps
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val, 0)) {
- caps.setRedBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_NATIVE_VISUAL_ID, val)) {
+ caps.setNativeVisualID(val.get(0));
+ }
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val)) {
+ caps.setRedBits(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val, 0)) {
- caps.setGreenBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val)) {
+ caps.setGreenBits(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val, 0)) {
- caps.setBlueBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val)) {
+ caps.setBlueBits(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val, 0)) {
- caps.setAlphaBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val)) {
+ caps.setAlphaBits(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val, 0)) {
- caps.setStencilBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val)) {
+ caps.setStencilBits(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val, 0)) {
- caps.setDepthBits(val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val)) {
+ caps.setDepthBits(val.get(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_SAMPLES, val)) {
+ caps.setSampleBuffers(val.get(0)>0?true:false);
+ caps.setNumSamples(val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_TYPE, val, 0)) {
- caps.setBackgroundOpaque(val[0] != EGL.EGL_TRANSPARENT_RGB);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_TYPE, val)) {
+ caps.setBackgroundOpaque(val.get(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_RED_VALUE, val)) {
+ caps.setTransparentRedValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(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_GREEN_VALUE, val)) {
+ caps.setTransparentGreenValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
}
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val, 0)) {
- caps.setTransparentBlueValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val)) {
+ caps.setTransparentBlueValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(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_TRANSPARENT_ALPHA_VALUE, val)) {
+ caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
} */
}
+ /**
+ if(caps.getNativeVisualID() == 0) {
+ boolean isWindowBit = 0 != ( drawableTypeBits & GLGraphicsConfigurationUtil.WINDOW_BIT );
+ drawableTypeBits &= ~GLGraphicsConfigurationUtil.WINDOW_BIT;
+ if( 0 == drawableTypeBits ) {
+ if(DEBUG) {
+ System.err.println("EGL_NATIVE_VISUAL_ID: 0, windowBit removed: "+isWindowBit+
+ ", no drawable bits left, bail out for: "+ caps);
+ }
+ return false;
+ }
+ } */
return GLGraphicsConfigurationUtil.addGLCapabilitiesPermutations(capsBucket, caps, drawableTypeBits );
}
@@ -275,12 +298,10 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
// 26
-
attrs[idx++] = EGL.EGL_RENDERABLE_TYPE;
if(caps.getGLProfile().usesNativeGLES1()) {
attrs[idx++] = EGL.EGL_OPENGL_ES_BIT;
- }
- else if(caps.getGLProfile().usesNativeGLES2()) {
+ } else if(caps.getGLProfile().usesNativeGLES2()) {
attrs[idx++] = EGL.EGL_OPENGL_ES2_BIT;
} else {
attrs[idx++] = EGL.EGL_OPENGL_BIT;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 70ad842f8..3154818db 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -49,13 +49,16 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
+
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.io.PrintStream;
+import java.nio.IntBuffer;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
@@ -106,23 +109,22 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
long eglDisplay = eglDevice.getHandle();
List/*<EGLGLCapabilities>*/ availableCaps = null;
- int[] maxConfigs = new int[1];
+ IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
- if(!EGL.eglGetConfigs(eglDisplay, null, 0, maxConfigs, 0)) {
+ if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) {
throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
- if(0 == maxConfigs[0]) {
+ if(0 == numConfigs.get(0)) {
throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) no configs");
}
- PointerBuffer configs = PointerBuffer.allocateDirect(maxConfigs[0]);
- int[] numConfigs = new int[1];
+ PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
- if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs, 0)) {
+ if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs)) {
throw new GLException("Graphics configuration get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
- if (numConfigs[0] > 0) {
- availableCaps = eglConfigs2GLCaps(null, eglDisplay, configs, numConfigs[0], GLGraphicsConfigurationUtil.ALL_BITS);
+ if (numConfigs.get(0) > 0) {
+ availableCaps = eglConfigs2GLCaps(null, eglDisplay, configs, numConfigs.get(0), GLGraphicsConfigurationUtil.ALL_BITS);
if( null != availableCaps && availableCaps.size() > 1) {
Collections.sort(availableCaps, EglCfgIDComparator);
}
@@ -131,7 +133,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
return availableCaps;
}
- private static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
+ /*package*/ static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
GLCapabilitiesImmutable capsReq,
GLCapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen) {
@@ -229,30 +231,29 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
List/*<EGLGLCapabilities>*/ availableCaps = null;
int recommendedIndex = -1;
long recommendedEGLConfig = -1;
- int[] maxConfigs = new int[1];
+ IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
- if(!EGL.eglGetConfigs(eglDisplay, null, 0, maxConfigs, 0)) {
+ if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) {
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
- if(0 == maxConfigs[0]) {
+ if(0 == numConfigs.get(0)) {
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) no configs");
}
if (DEBUG) {
- System.err.println("EGLGraphicsConfiguration.eglChooseConfig: eglChooseConfig maxConfigs: "+maxConfigs[0]);
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: eglChooseConfig maxConfigs: "+numConfigs.get(0));
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: eglDisplay "+toHexString(eglDisplay)+", "+capsChosen);
}
- final int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen);
- PointerBuffer configs = PointerBuffer.allocateDirect(maxConfigs[0]);
- int[] numConfigs = new int[1];
+ final IntBuffer attrs = Buffers.newDirectIntBuffer(EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen));
+ PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
- if( ! EGL.eglChooseConfig(eglDisplay, attrs, 0, configs, configs.capacity(), numConfigs, 0) ) {
+ if( ! EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
if(DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: false");
}
- } else if (numConfigs[0] > 0) {
- availableCaps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0], winattrmask);
+ } else if (numConfigs.get(0) > 0) {
+ availableCaps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs.get(0), winattrmask);
if(availableCaps.size() > 0) {
recommendedEGLConfig = configs.get(0);
recommendedIndex = 0;
@@ -273,11 +274,11 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
recommendedEGLConfig = -1;
recommendedIndex = -1;
- if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs, 0)) {
+ if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs)) {
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: #2 Get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
- if (numConfigs[0] > 0) {
- availableCaps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs[0], winattrmask);
+ if (numConfigs.get(0) > 0) {
+ availableCaps = eglConfigs2GLCaps(glp, eglDisplay, configs, numConfigs.get(0), winattrmask);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
index 6cbd1ee6a..5fb32e6cd 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
@@ -46,13 +46,14 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
+import jogamp.opengl.x11.glx.GLX;
+
public class EGLPbufferDrawable extends EGLDrawable {
private int texFormat;
protected static final boolean useTexture = false; // No yet ..
protected EGLPbufferDrawable(EGLDrawableFactory factory, NativeSurface target) {
super(factory, target);
- ownEGLDisplay = true;
// get choosen ones ..
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)
@@ -76,6 +77,10 @@ public class EGLPbufferDrawable extends EGLDrawable {
}
+ protected void destroyImpl() {
+ setRealized(false);
+ }
+
protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
NativeSurface nw = getNativeSurface();
int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 6ce793490..3a0f28352 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -116,9 +116,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
+ public final boolean getWasSharedContextCreated(AbstractGraphicsDevice device) {
+ // FIXME: not implemented .. needs a dummy OSX surface
+ return false;
+ }
+
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
- // FIXME: not implemented .. needs a dummy OSX surface
- return null;
+ // FIXME: not implemented .. needs a dummy OSX surface
+ return null;
}
protected AbstractGraphicsDevice getOrCreateSharedDeviceImpl(AbstractGraphicsDevice device) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
index 94d790cee..e81a9f4c5 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
@@ -62,7 +62,7 @@ public class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBu
return res; */
}
- public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return 0;
/** OSX manual says: NSImage use is discouraged
return CGL.getProcAddress(glFuncName); // manual implementation
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 13bb24237..f8ba8d277 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -373,6 +373,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final static String WGL_ARB_make_current_read = "WGL_ARB_make_current_read";
final static String wglMakeContextCurrent = "wglMakeContextCurrent";
+ public final boolean getWasSharedContextCreated(AbstractGraphicsDevice device) {
+ SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
+ if(null!=sr) {
+ return null != sr.getContext();
+ }
+ return false;
+ }
+
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
index 0fb7f4510..c7feb83c7 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
@@ -51,7 +51,7 @@ public class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryB
return res;
}
- public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return WGL.wglGetProcAddress(toolGetProcAddressHandle, funcName);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 14f2a28f1..1caf1e24b 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -47,6 +47,7 @@ import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
import jogamp.opengl.*;
+
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import jogamp.nativewindow.WrappedSurface;
@@ -260,6 +261,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
return false;
}
+ public final boolean getWasSharedContextCreated(AbstractGraphicsDevice device) {
+ SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
+ if(null!=sr) {
+ return null != sr.getContext();
+ }
+ return false;
+ }
+
protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(device);
if(null!=sr) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
index 60e163c46..aa6e3e849 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
@@ -76,7 +76,7 @@ public class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundl
return res;
}
- public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return GLX.glXGetProcAddress(toolGetProcAddressHandle, funcName);
}
}