summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java64
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java123
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java39
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java6
12 files changed, 129 insertions, 123 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 41acf3e37..9e861bf52 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -90,27 +90,24 @@ public abstract class GLContext {
/** Indicates that a newly-created context was made current during the last call to {@link #makeCurrent makeCurrent}. */
public static final int CONTEXT_CURRENT_NEW = 2;
- /** <code>ARB_create_context</code> related: created via ARB_create_context */
+ /** <code>ARB_create_context</code> related: created via ARB_create_context. Cache key value. */
protected static final int CTX_IS_ARB_CREATED = 1 << 0;
- /** <code>ARB_create_context</code> related: compatibility profile */
+ /** <code>ARB_create_context</code> related: compatibility profile. Cache key value. */
protected static final int CTX_PROFILE_COMPAT = 1 << 1;
- /** <code>ARB_create_context</code> related: core profile */
+ /** <code>ARB_create_context</code> related: core profile. Cache key value. */
protected static final int CTX_PROFILE_CORE = 1 << 2;
- /** <code>ARB_create_context</code> related: ES profile */
+ /** <code>ARB_create_context</code> related: ES profile. Cache key value. */
protected static final int CTX_PROFILE_ES = 1 << 3;
- /** <code>ARB_create_context</code> related: flag forward compatible */
+ /** <code>ARB_create_context</code> related: flag forward compatible. Cache key value. */
protected static final int CTX_OPTION_FORWARD = 1 << 4;
- /** <code>ARB_create_context</code> related: flag not forward compatible */
- protected static final int CTX_OPTION_ANY = 1 << 5;
- /** <code>ARB_create_context</code> related: flag debug */
- public static final int CTX_OPTION_DEBUG = 1 << 6;
- /** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2 */
+ /** <code>ARB_create_context</code> related: flag debug. Not a cache key. */
+ public static final int CTX_OPTION_DEBUG = 1 << 5;
+
+ /** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. */
protected static final int CTX_IMPL_ES2_COMPAT = 1 << 8;
- /** Implementation / GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL software implementation */
- protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 14;
- /** Implementation / GLContext {@link com.jogamp.gluegen.runtime.ProcAddressTable} caching related: GL hardware implementation */
- protected static final int CTX_IMPL_ACCEL_HARD = 1 << 15;
+ /** Context uses software rasterizer, otherwise hardware rasterizer. Cache key value. */
+ protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 15;
private static ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>();
@@ -495,12 +492,10 @@ public abstract class GLContext {
* <li> options
* <ul>
* <li> <code>ES profile</code> ES profile</li>
- * <li> <code>Compatibility profile</code>Compatibility profile including fixed function pipeline and deprecated functionality</li>
- * <li> <code>Core profile</code>Core profile</li>
- * <li> <code>forward</code>Forward profile excluding deprecated functionality</li>
- * <li> <code>any</code> refers to the non forward compatible context</li>
- * <li> <code>old</code> refers to the non ARB_create_context created context</li>
- * <li> <code>new</code> refers to the ARB_create_context created context</li>
+ * <li> <code>Compatibility profile</code> Compatibility profile including fixed function pipeline and deprecated functionality</li>
+ * <li> <code>Core profile</code> Core profile</li>
+ * <li> <code>forward</code> Forward profile excluding deprecated functionality</li>
+ * <li> <code>arb</code> refers to an ARB_create_context created context</li>
* <li> <code>debug</code> refers to a debug context</li>
* <li> <code>ES2 compatible</code> refers to an ES2 compatible implementation</li>
* <li> <code>software</code> refers to a software implementation of the rasterizer</li>
@@ -519,14 +514,14 @@ public abstract class GLContext {
* </table>
*
* <table border="0">
- * <tr><td></td> <td>ES2</td> <td><code>2.0 (ES profile, any, new, ES2 compatible, hardware) - 2.0 ES Profile</code></td></tr>
- * <tr><td>ATI</td><td>GL2</td> <td><code>3.0 (Compatibility profile, any, new, hardware) - 3.2.9704 Compatibility Profile Context</code></td></tr>
+ * <tr><td></td> <td>ES2</td> <td><code>2.0 (ES profile, ES2 compatible, hardware) - 2.0 ES Profile</code></td></tr>
+ * <tr><td>ATI</td><td>GL2</td> <td><code>3.0 (Compatibility profile, arb, hardware) - 3.2.9704 Compatibility Profile Context</code></td></tr>
* <tr><td>ATI</td><td>GL3</td> <td><code>3.3 (Core profile, any, new, hardware) - 1.4 (3.2.9704 Compatibility Profile Context)</code></td></tr>
- * <tr><td>ATI</td><td>GL3bc</td><td><code>3.3 (Compatibility profile, any, new, hardware) - 1.4 (3.2.9704 Compatibility Profile Context)</code></td></tr>
- * <tr><td>NV</td><td>GL2</td> <td><code>3.0 (Compatibility profile, any, new, hardware) - 3.0.0 NVIDIA 195.36.07.03</code></td></tr>
- * <tr><td>NV</td><td>GL3</td> <td><code>3.3 (Core profile, any, new, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
- * <tr><td>NV</td><td>GL3bc</td> <td><code>3.3 (Compatibility profile, any, new, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
- * <tr><td>NV</td><td>GL2</td> <td><code>3.0 (Compatibility profile, any, new, ES2 compatible, hardware) - 3.0.0 NVIDIA 290.10</code></td></tr>
+ * <tr><td>ATI</td><td>GL3bc</td><td><code>3.3 (Compatibility profile, arb, hardware) - 1.4 (3.2.9704 Compatibility Profile Context)</code></td></tr>
+ * <tr><td>NV</td><td>GL2</td> <td><code>3.0 (Compatibility profile, arb, hardware) - 3.0.0 NVIDIA 195.36.07.03</code></td></tr>
+ * <tr><td>NV</td><td>GL3</td> <td><code>3.3 (Core profile, arb, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
+ * <tr><td>NV</td><td>GL3bc</td> <td><code>3.3 (Compatibility profile, arb, hardware) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
+ * <tr><td>NV</td><td>GL2</td> <td><code>3.0 (Compatibility profile, arb, ES2 compatible, hardware) - 3.0.0 NVIDIA 290.10</code></td></tr>
* </table>
*/
public final String getGLVersion() {
@@ -538,7 +533,7 @@ public abstract class GLContext {
public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); }
public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); }
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
- public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
+ public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
/**
@@ -1001,14 +996,15 @@ public abstract class GLContext {
needColon = appendString(sb, "ES profile", needColon, 0 != ( CTX_PROFILE_ES & ctp ));
needColon = appendString(sb, "Compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp ));
needColon = appendString(sb, "Core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp ));
- needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
- needColon = appendString(sb, "any", needColon, 0 != ( CTX_OPTION_ANY & ctp ));
- needColon = appendString(sb, "new", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp ));
- needColon = appendString(sb, "old", needColon, 0 == ( CTX_IS_ARB_CREATED & ctp ));
+ needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
+ needColon = appendString(sb, "arb", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp ));
needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp ));
needColon = appendString(sb, "ES2 compatible", needColon, 0 != ( CTX_IMPL_ES2_COMPAT & ctp ));
- needColon = appendString(sb, "software", needColon, 0 != ( CTX_IMPL_ACCEL_SOFT & ctp ));
- needColon = appendString(sb, "hardware", needColon, 0 != ( CTX_IMPL_ACCEL_HARD & ctp ));
+ if( 0 != ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
+ needColon = appendString(sb, "software", needColon, true);
+ } else {
+ needColon = appendString(sb, "hardware", needColon, true);
+ }
sb.append(")");
if(null!=gl_version) {
sb.append(" - ");
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 91dcd4e27..9f0093230 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1464,7 +1464,7 @@ public class GLProfile {
// so we have to add the usual suspect
GLContext.mapAvailableGLVersion(device,
2, GLContext.CTX_PROFILE_COMPAT,
- 1, 5, GLContext.CTX_PROFILE_COMPAT|GLContext.CTX_OPTION_ANY);
+ 1, 5, GLContext.CTX_PROFILE_COMPAT);
}
addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */);
}
@@ -1501,13 +1501,13 @@ public class GLProfile {
// The native ES2 impl. overwrites a previous mapping using 'ES2 compatibility' by a desktop profile
GLContext.mapAvailableGLVersion(device,
2, GLContext.CTX_PROFILE_ES,
- 2, 0, GLContext.CTX_PROFILE_ES|GLContext.CTX_OPTION_ANY|GLContext.CTX_IMPL_ES2_COMPAT);
+ 2, 0, GLContext.CTX_PROFILE_ES|GLContext.CTX_IMPL_ES2_COMPAT);
}
if( hasGLES1Impl ) {
// Always favor the native ES1 impl.
GLContext.mapAvailableGLVersion(device,
1, GLContext.CTX_PROFILE_ES,
- 1, 0, GLContext.CTX_PROFILE_ES|GLContext.CTX_OPTION_ANY);
+ 1, 0, GLContext.CTX_PROFILE_ES);
}
addedEGLProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */);
}
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index 55dd0fe11..a4fb1147c 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -52,20 +52,15 @@ import java.util.*;
final class ExtensionAvailabilityCache {
protected static final boolean DEBUG = GLContextImpl.DEBUG;
- ExtensionAvailabilityCache(GLContextImpl context)
- {
- this.context = context;
+ ExtensionAvailabilityCache() {
+ flush();
}
/**
- * Flush the cache. The cache will be rebuilt lazily as calls to {@link
- * #isExtensionAvailable(String)} are received.
+ * Flush the cache.
*/
final void flush()
{
- if(DEBUG) {
- System.out.println("ExtensionAvailabilityCache: Flush availability OpenGL "+context.getGLVersion());
- }
initialized = false;
glExtensions = null;
glExtensionCount = 0;
@@ -75,11 +70,11 @@ final class ExtensionAvailabilityCache {
}
/**
- * Flush the cache and rebuild the cache.
+ * Flush and rebuild the cache.
*/
- final void reset() {
+ final void reset(GLContextImpl context) {
flush();
- initAvailableExtensions();
+ initAvailableExtensions(context);
}
final boolean isInitialized() {
@@ -87,45 +82,52 @@ final class ExtensionAvailabilityCache {
}
final int getTotalExtensionCount() {
- initAvailableExtensions();
+ validateInitialization();
return availableExtensionCache.size();
}
final boolean isExtensionAvailable(String glExtensionName) {
- initAvailableExtensions();
+ validateInitialization();
return availableExtensionCache.contains(mapGLExtensionName(glExtensionName));
}
final int getPlatformExtensionCount() {
- initAvailableExtensions();
+ validateInitialization();
return glXExtensionCount;
}
final String getPlatformExtensionsString() {
- initAvailableExtensions();
+ validateInitialization();
return glXExtensions;
}
final int getGLExtensionCount() {
- initAvailableExtensions();
+ validateInitialization();
return glExtensionCount;
}
final String getGLExtensionsString() {
- initAvailableExtensions();
+ validateInitialization();
if(DEBUG) {
System.err.println("ExtensionAvailabilityCache: getGLExtensions() called");
}
return glExtensions;
}
- private final void initAvailableExtensions() {
- GL gl = context.getGL();
- // if hash is empty (meaning it was flushed), pre-cache it with the list
- // of extensions that are in the GL_EXTENSIONS string
- if (availableExtensionCache.isEmpty() || !initialized) {
+ private final void validateInitialization() {
+ if (!isInitialized()) {
+ throw new InternalError("ExtensionAvailabilityCache not initialized!");
+ }
+ }
+ private final void initAvailableExtensions(GLContextImpl context) {
+ GL gl = context.getGL();
+ // if hash is empty (meaning it was flushed), pre-cache it with the list
+ // of extensions that are in the GL_EXTENSIONS string
+ if (isInitialized()) {
+ throw new InternalError("ExtensionAvailabilityCache already initialized!");
+ }
if (DEBUG) {
- System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Pre-caching init "+gl+", OpenGL "+context.getGLVersion());
+ System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Pre-caching init "+gl+", OpenGL "+context.getGLVersion());
}
boolean useGetStringi = false;
@@ -134,43 +136,43 @@ final class ExtensionAvailabilityCache {
// on GL2 platforms the function might be available, but not working.
if ( context.isGL3() ) {
if ( ! context.isFunctionAvailable("glGetStringi") ) {
- if(DEBUG) {
- System.err.println("GLContext: GL >= 3.1 usage, but no glGetStringi");
- }
+ if(DEBUG) {
+ System.err.println("GLContext: GL >= 3.1 usage, but no glGetStringi");
+ }
} else {
useGetStringi = true;
}
}
if (DEBUG) {
- System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+context.getGLVersion()+
- ", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
+ System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+context.getGLVersion()+
+ ", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile
if(useGetStringi) {
- GL2GL3 gl2gl3 = gl.getGL2GL3();
- final int count;
- {
- int[] val = { 0 } ;
- gl2gl3.glGetIntegerv(GL2GL3.GL_NUM_EXTENSIONS, val, 0);
- count = val[0];
- }
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < count; i++) {
- if(i > 0) {
- sb.append(" ");
- }
- final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i);
- glExtensionSet.add(ext);
- sb.append(ext);
- }
- if(0==count || sb.length()==0) {
- // fall back ..
- useGetStringi=false;
- } else {
- glExtensions = sb.toString();
- }
+ GL2GL3 gl2gl3 = gl.getGL2GL3();
+ final int count;
+ {
+ int[] val = { 0 } ;
+ gl2gl3.glGetIntegerv(GL2GL3.GL_NUM_EXTENSIONS, val, 0);
+ count = val[0];
+ }
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < count; i++) {
+ if(i > 0) {
+ sb.append(" ");
+ }
+ final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i);
+ glExtensionSet.add(ext);
+ sb.append(ext);
+ }
+ if(0==count || sb.length()==0) {
+ // fall back ..
+ useGetStringi=false;
+ } else {
+ glExtensions = sb.toString();
+ }
}
if(!useGetStringi) {
glExtensions = gl.glGetString(GL.GL_EXTENSIONS);
@@ -183,9 +185,10 @@ final class ExtensionAvailabilityCache {
}
glExtensionCount = glExtensionSet.size();
if (DEBUG) {
- System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL_EXTENSIONS: "+glExtensionCount);
+ System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL_EXTENSIONS: "+glExtensionCount+
+ ", used "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
-
+
// Platform Extensions
HashSet<String> glXExtensionSet = new HashSet<String>(50);
{
@@ -204,10 +207,10 @@ final class ExtensionAvailabilityCache {
glXExtensions = sb.toString();
glXExtensionCount = glXExtensionSet.size();
}
-
+
availableExtensionCache.addAll(glExtensionSet);
availableExtensionCache.addAll(glXExtensionSet);
-
+
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GLX_EXTENSIONS: "+glXExtensionCount);
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL vendor: " + gl.glGetString(GL.GL_VENDOR));
@@ -218,11 +221,11 @@ final class ExtensionAvailabilityCache {
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;
+ 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;
}
}
@@ -231,7 +234,6 @@ final class ExtensionAvailabilityCache {
availableExtensionCache.add("<INTERNAL_DUMMY_PLACEHOLDER>");
initialized = true;
- }
}
// FIXME: hack to re-enable GL_NV_vertex_array_range extension after
@@ -254,7 +256,6 @@ final class ExtensionAvailabilityCache {
private String glXExtensions = null;
private int glXExtensionCount = 0;
private HashSet<String> availableExtensionCache = new HashSet<String>(50);
- private GLContextImpl context;
static String getThreadName() {
return Thread.currentThread().getName();
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index f33c2bdb1..1924ba409 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -666,7 +666,7 @@ public abstract class GLContextImpl extends GLContext {
private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat) {
long _context;
int reqProfile = compat ? CTX_PROFILE_COMPAT : CTX_PROFILE_CORE ;
- int ctp = CTX_IS_ARB_CREATED | CTX_PROFILE_CORE | CTX_OPTION_ANY; // default
+ int ctp = CTX_IS_ARB_CREATED | CTX_PROFILE_CORE; // default
if(compat) {
ctp &= ~CTX_PROFILE_CORE ;
ctp |= CTX_PROFILE_COMPAT ;
@@ -697,7 +697,6 @@ public abstract class GLContextImpl extends GLContext {
if(0==_context && !compat) {
ctp &= ~CTX_PROFILE_COMPAT ;
ctp |= CTX_PROFILE_CORE ;
- ctp &= ~CTX_OPTION_ANY ;
ctp |= CTX_OPTION_FORWARD ;
_context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
@@ -708,7 +707,6 @@ public abstract class GLContextImpl extends GLContext {
ctp &= ~CTX_PROFILE_CORE ;
ctp |= CTX_PROFILE_COMPAT ;
ctp &= ~CTX_OPTION_FORWARD ;
- ctp |= CTX_OPTION_ANY ;
_context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
@@ -796,7 +794,7 @@ public abstract class GLContextImpl extends GLContext {
* If major==0 && minor == 0 : Use GL_VERSION
* Otherwise .. don't touch ..
*/
- private final void setContextVersion(int major, int minor, int ctp) {
+ private final void setContextVersion(int major, int minor, int ctp, boolean setVersionString) {
if (0==ctp) {
throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp));
}
@@ -808,7 +806,9 @@ public abstract class GLContextImpl extends GLContext {
ctxMajorVersion = major;
ctxMinorVersion = minor;
ctxOptions = ctp;
- ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, getGL().glGetString(GL.GL_VERSION));
+ if(setVersionString) {
+ ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, getGL().glGetString(GL.GL_VERSION));
+ }
return;
}
@@ -831,7 +831,9 @@ public abstract class GLContextImpl extends GLContext {
ctxMajorVersion = 3;
ctxMinorVersion = 0;
}
- ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, versionStr);
+ if(setVersionString) {
+ ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, versionStr);
+ }
return;
}
}
@@ -951,7 +953,9 @@ public abstract class GLContextImpl extends GLContext {
AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
- ctxProfileBits |= drawable.getChosenGLCapabilities().getHardwareAccelerated() ? GLContext.CTX_IMPL_ACCEL_HARD : GLContext.CTX_IMPL_ACCEL_SOFT;
+ if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
+ ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
+ }
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -985,7 +989,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
//
// Update ExtensionAvailabilityCache
//
@@ -999,8 +1003,9 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": !!! GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount());
}
} else {
- extensionAvailability = new ExtensionAvailabilityCache(this);
- extensionAvailability.reset();
+ extensionAvailability = new ExtensionAvailabilityCache();
+ setContextVersion(major, minor, ctxProfileBits, false); // pre-set of GL version, required for extension cache usage
+ extensionAvailability.reset(this);
synchronized(mappedContextTypeObjectLock) {
mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability);
if(DEBUG) {
@@ -1013,15 +1018,17 @@ public abstract class GLContextImpl extends GLContext {
}
//
- // Set GL Version
+ // Set GL Version (complete w/ version string)
//
- setContextVersion(major, minor, ctxProfileBits);
+ setContextVersion(major, minor, ctxProfileBits, true);
}
protected final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
- ctxProfileBits |= drawable.getChosenGLCapabilities().getHardwareAccelerated() ? GLContext.CTX_IMPL_ACCEL_HARD : GLContext.CTX_IMPL_ACCEL_SOFT;
+ if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
+ ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
+ }
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": !!! RM Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -1041,7 +1048,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
/**
* Updates the platform's 'GLX' function cache
*/
@@ -1124,7 +1131,9 @@ public abstract class GLContextImpl extends GLContext {
}
protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits) {
- ctxProfileBits &= ~GLContext.CTX_IMPL_ES2_COMPAT ; // remove non-key value
+ // remove non-key values
+ ctxProfileBits &= ~( GLContext.CTX_OPTION_DEBUG | GLContext.CTX_IMPL_ES2_COMPAT ) ;
+
return device.getUniqueID() + "-" + toHexString(composeBits(major, minor, ctxProfileBits));
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 24095c749..e1473e541 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -205,7 +205,7 @@ public abstract class EGLContext extends GLContextImpl {
throw new GLException("Error making context 0x" +
Long.toHexString(contextHandle) + " current: error code " + EGL.eglGetError());
}
- int ctp = CTX_PROFILE_ES|CTX_OPTION_ANY;
+ int ctp = CTX_PROFILE_ES;
int major;
if(glProfile.usesNativeGLES2()) {
ctp |= CTX_IMPL_ES2_COMPAT;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
index 796a4311b..ff60a5262 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
@@ -45,7 +45,7 @@ public class EGLExternalContext extends EGLContext {
public EGLExternalContext(AbstractGraphicsScreen screen) {
super(null, null);
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_IS_ARB_CREATED|CTX_PROFILE_ES|CTX_OPTION_ANY);
+ setGLFunctionAvailability(false, 0, 0, CTX_IS_ARB_CREATED|CTX_PROFILE_ES);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index 6ce2d7ba7..0e54b09ec 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -64,7 +64,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
drawable.registerContext(this);
this.contextHandle = handle;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
index 70416d1f4..f41400d83 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
@@ -97,7 +97,7 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
}
return false;
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION
contextHandle = ctx;
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
index b183ad59f..b09a038d8 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
@@ -65,7 +65,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
System.err.println(getThreadName() + ": !!! Created external OpenGL context " + toHexString(ctx) + " for " + this);
}
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 66c203a44..6fc5ab8d0 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -296,7 +296,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (!WGL.wglMakeCurrent(drawable.getHandle(), temp_ctx)) {
throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: "+GDI.GetLastError());
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION
boolean isCreateContextAttribsARBAvailable = isFunctionAvailable("wglCreateContextAttribsARB");
WGL.wglMakeCurrent(0, 0); // release temp context
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 4a949ea74..6334799c0 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -53,7 +53,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
super(drawable, null);
this.contextHandle = ctx;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index d8813ed7f..0225c4284 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -220,7 +220,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if( !ctBwdCompat && ctFwdCompat ) {
flags |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
}
- if( ctDebug) {
+ if( ctDebug ) {
flags |= GLX.GLX_CONTEXT_DEBUG_BIT_ARB;
}
attribs.put(ctx_arb_attribs_idx_flags + 1, flags);
@@ -305,7 +305,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if (!glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
throw new GLException("Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION
isDirect = GLX.glXIsDirect(display, contextHandle);
if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: OK (old-1) share "+share+", direct "+isDirect+"/"+direct);
@@ -335,7 +335,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if (!glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), temp_ctx)) {
throw new GLException("Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT); // use GL_VERSION
boolean isCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB");
glXMakeContextCurrent(display, 0, 0, 0); // release temp context