diff options
author | Sven Gothel <[email protected]> | 2013-04-26 07:41:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-26 07:41:12 +0200 |
commit | ff9fb2d0adc81fdf25d6e26b91e1f67d8241e3e4 (patch) | |
tree | 50d846b7475b6cfa2bdb06e74912dccfc8fbed1b /src | |
parent | 36dc4f5ab6957a4078842c488afb51df2fdc0630 (diff) |
GLContext*'s ctxGLSLVersion: Use zeroVersion to denominate uninitialized VersionNumber instead of null, it's get*string returns a zero length string instead of null.
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 20 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLContextImpl.java | 6 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index f303c5b1c..288329310 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -189,7 +189,7 @@ public abstract class GLContext { ctxVendorVersion = VersionNumberString.zeroVersion; ctxOptions=0; ctxVersionString=null; - ctxGLSLVersion=null; + ctxGLSLVersion = VersionNumber.zeroVersion; attachedObjects.clear(); contextHandle=0; currentSwapInterval = -1; @@ -671,7 +671,7 @@ public abstract class GLContext { * Returns the vendor's version, i.e. version number at the end of <code>GL_VERSION</code> not being the GL version. * <p> * In case no such version exists within <code>GL_VERSION</code>, - * the {@link VersionNumberString#zeroVersion zero version} instance is being returned. + * the {@link VersionNumberString#zeroVersion zero version} instance is returned. * </p> * <p> * The vendor's version is usually the vendor's OpenGL driver version. @@ -689,13 +689,14 @@ public abstract class GLContext { * via {@link GL2ES2#GL_SHADING_LANGUAGE_VERSION} if ≥ ES2.0 or GL2.0, * otherwise a static match is being utilized. * <p> - * The context must have been current once, otherwise <code>null</code> is returned. + * The context must have been current once, + * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. * </p> * <p> * Examples w/ <code>major.minor</code>: * <pre> - * 1.00 (ES2.0), 1.10 (GL2.0), 1.20 (GL2.1), 1.50 GL(3.2), - * 3.30 (GL3.3), 4.40 (GL4.0) + * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2), + * 3.30 (GL 3.3), 4.00 (GL 4.0), 4.10 (GL 4.1), 4.20 (GL 4.2) * </pre > * </p> * <p> @@ -704,7 +705,8 @@ public abstract class GLContext { * The latter is not true on OSX w/ a GL3 context. * </p> * - * @param GLSL version number if context has been made current at least once, otherwise <code>null</code>. + * @return GLSL version number if context has been made current at least once, + * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned. * * @see #getGLVersionNumber() */ @@ -719,13 +721,13 @@ public abstract class GLContext { * #version 110 * </pre> * <p> - * If context has not been made current, <code>null</code> is returned. + * If context has not been made current yet, a string of zero length is returned. * </p> * @see #getGLSLVersionNumber() */ public final String getGLSLVersionString() { - if(null == ctxGLSLVersion) { - return null; + if( ctxGLSLVersion.isZero() ) { + return ""; } final int minor = ctxGLSLVersion.getMinor(); return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + "\n" ; diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index 1b8b0316c..b947bd693 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -1041,17 +1041,17 @@ public abstract class GLContextImpl extends GLContext { ctxVendorVersion = glVendorVersion; ctxOptions = ctp; if(useGL) { - ctxGLSLVersion = null; + ctxGLSLVersion = VersionNumber.zeroVersion; if(major >= 2) { // >= ES2 || GL2.0 final String glslVersion = gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION); if( null != glslVersion ) { ctxGLSLVersion = new VersionNumber(glslVersion, "."); if( ctxGLSLVersion.getMajor() < 1 ) { - ctxGLSLVersion = null; // failed .. + ctxGLSLVersion = VersionNumber.zeroVersion; // failed .. } } } - if( null == ctxGLSLVersion ){ + if( ctxGLSLVersion.isZero() ) { final int[] sver = new int[2]; getStaticGLSLVersionNumber(major, minor, ctxOptions, sver); ctxGLSLVersion = new VersionNumber(sver[0], sver[1], 0); |