From 9b6efe652c8be325734c04cd6603d6014cbc886a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 3 Jul 2013 11:45:04 +0200 Subject: GLContext: Rename 2-digit VersionNumber statics aligning w/ all 3-digit names, e.g. Version31 -> Version310. ; Trim GLVersionNumber string. --- .../com/jogamp/opengl/util/glsl/ShaderUtil.java | 2 +- src/jogl/classes/javax/media/opengl/GLContext.java | 20 ++++++++++---------- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 4 ++-- src/jogl/classes/jogamp/opengl/GLVersionNumber.java | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index 7d110659a..066b2054d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -221,7 +221,7 @@ public class ShaderUtil { /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */ public static boolean isGeometryShaderSupported(GL _gl) { final GLContext ctx = _gl.getContext(); - return ctx.getGLVersionNumber().compareTo(GLContext.Version32) >= 0 || + return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 || ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4); } diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index cc37da0ff..84d371ac6 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -131,16 +131,16 @@ public abstract class GLContext { /* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */ public static final VersionNumber Version150 = new VersionNumber(1, 50, 0); - /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ - public static final VersionNumber Version32 = new VersionNumber(3, 2, 0); + /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. */ + public static final VersionNumber Version300 = new VersionNumber(3, 0, 0); /** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */ - public static final VersionNumber Version31 = new VersionNumber(3, 1, 0); + public static final VersionNumber Version310 = new VersionNumber(3, 1, 0); - /** Version 3.0. As an OpenGL version, it qualifies for {@link #isGL2()} only */ - public static final VersionNumber Version30 = new VersionNumber(3, 0, 0); + /** Version 3.2. As an OpenGL version, it qualifies for geometry shader */ + public static final VersionNumber Version320 = new VersionNumber(3, 2, 0); - protected static final VersionNumber Version80 = new VersionNumber(8, 0, 0); + protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0); /** ARB_create_context related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */ protected static final int CTX_IS_ARB_CREATED = 1 << 0; @@ -753,7 +753,7 @@ public abstract class GLContext { return ""; } final int minor = ctxGLSLVersion.getMinor(); - final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version30) >= 0 ? " es" : ""; + final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : ""; return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ; } @@ -899,21 +899,21 @@ public abstract class GLContext { /** @see GLProfile#isGL3bc() */ public final boolean isGL3bc() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_COMPAT); } /** @see GLProfile#isGL3() */ public final boolean isGL3() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)); } /** Indicates whether this profile is capable of GL3 (core only). GL3 starts w/ OpenGL 3.1

Includes [ GL4, GL3 ].

*/ public final boolean isGL3core() { - return ctxVersion.compareTo(Version31) >= 0 + return ctxVersion.compareTo(Version310) >= 0 && 0 != (ctxOptions & CTX_IS_ARB_CREATED) && 0 != (ctxOptions & CTX_PROFILE_CORE); } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d6f97662e..956ba4659 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -671,7 +671,7 @@ public abstract class GLContextImpl extends GLContext { if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile final int reqMajor; final int reqProfile; - if( ctxVersion.compareTo(Version30) <= 0 ) { + if( ctxVersion.compareTo(Version300) <= 0 ) { reqMajor = 2; } else { reqMajor = ctxVersion.getMajor(); @@ -1605,7 +1605,7 @@ public abstract class GLContextImpl extends GLContext { // final int quirk = GLRendererQuirks.DontCloseX11Display; if( glRenderer.contains(MesaSP) ) { - if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version80) < 0 ) { + if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version800) < 0 ) { if(DEBUG) { System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]"); } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index cea3ac4ab..e4187b35b 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -110,7 +110,7 @@ public class GLVersionNumber extends VersionNumberString { String str; { final GLVersionNumber glv = create(versionString); - str = versionString.substring(glv.endOfStringMatch()); + str = versionString.substring(glv.endOfStringMatch()).trim(); } while ( str.length() > 0 ) { @@ -120,7 +120,7 @@ public class GLVersionNumber extends VersionNumberString { if( version.hasMajor() && version.hasMinor() ) { // Requires at least a defined major and minor version component! return version; } - str = str.substring( eosm ); + str = str.substring( eosm ).trim(); } else { break; // no match } -- cgit v1.2.3