aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-12-21 21:38:53 +0100
committerSven Gothel <[email protected]>2013-12-21 21:38:53 +0100
commitddd5eb35b83ca85dbf43039e8199a7ecf011cdd8 (patch)
tree2e8ca83c659cf28ab2088bc1b59a254e68a8c96a /src/jogl/classes/jogamp/opengl
parent972feb4be95d1c16c71b84694729952e91dda668 (diff)
Bug 925 - Refine GLContextImpl.setGLFunctionAvailability(..)'s ES version validation
Refine GLContextImpl.setGLFunctionAvailability(..)'s ES version validation: + // - fail if ES major-version mismatch: + // - request 1, >= 3 must be equal + // - request 2 must be [2..3] i.e. the following is accepted, otherwise fails: request has 1 1 2 2,3 3 3 4 4 ...
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index d081c4adf..808d837ce 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1454,11 +1454,17 @@ public abstract class GLContextImpl extends GLContext {
// Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
// Otherwise:
// - fail if hasVersion < reqVersion (desktop and ES)
- // - fail if ES 1.0 major-version mismatch
+ // - fail if ES major-version mismatch:
+ // - request 1, >= 3 must be equal
+ // - request 2 must be [2..3]
//
+ final int hasMajor = hasGLVersionByInt.getMajor();
if( strictMatch &&
( ( ( isES || major >= 3 ) && hasGLVersionByInt.compareTo(reqGLVersion) < 0 ) ||
- ( isES && 1 == major && major != hasGLVersionByInt.getMajor() )
+ ( isES &&
+ ( 2 == major && ( 2 > hasMajor || hasMajor > 3 ) ) || // 2 -> [2..3]
+ ( ( 1 == major || 3 <= major ) && major != hasMajor ) // 1,3,.. -> equal
+ )
) ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (Int): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByInt);
@@ -1489,11 +1495,17 @@ public abstract class GLContextImpl extends GLContext {
// Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
// Otherwise:
// - fail if hasVersion < reqVersion (desktop and ES)
- // - fail if ES 1.0 major-version mismatch
+ // - fail if ES major-version mismatch:
+ // - request 1, >= 3 must be equal
+ // - request 2 must be [2..3]
//
+ final int hasMajor = hasGLVersionByString.getMajor();
if( strictMatch &&
( ( ( isES || major >= 3 ) && hasGLVersionByString.compareTo(reqGLVersion) < 0 ) ||
- ( isES && 1 == major && major != hasGLVersionByString.getMajor() )
+ ( isES &&
+ ( 2 == major && ( 2 > hasMajor || hasMajor > 3 ) ) || // 2 -> [2..3]
+ ( ( 1 == major || 3 <= major ) && major != hasMajor ) // 1,3,.. -> equal
+ )
) ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (String): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByString);