summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-02 07:16:58 +0200
committerSven Gothel <[email protected]>2014-09-02 07:16:58 +0200
commitfbbc153150faecdaa7f37c15eb03fc484276bb40 (patch)
tree233305ba27c0da4cb751dec4ac83509efed2c483 /src/jogl/classes/javax
parentdfae07ed4b0f164768c35b6e7ad008d81a3e68bb (diff)
Bug 1058 - Fix GLContext.getGLSLVersionString(): Add 'profile' after version for GLSL >= 150 allowing GLSL compatibility profile
Diffstat (limited to 'src/jogl/classes/javax')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 8266e84c9..8617df95c 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -148,6 +148,8 @@ public abstract class GLContext {
protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
+ private static final String S_EMPTY = "";
+
//
// Cached keys, bits [0..15]
//
@@ -818,8 +820,8 @@ public abstract class GLContext {
* <pre>
* #version 110
* ..
- * #version 150
- * #version 330
+ * #version 150 core
+ * #version 330 compatibility
* ...
* </pre>
* And for ES:
@@ -835,11 +837,20 @@ public abstract class GLContext {
*/
public final String getGLSLVersionString() {
if( ctxGLSLVersion.isZero() ) {
- return "";
+ return S_EMPTY;
}
final int minor = ctxGLSLVersion.getMinor();
- final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
- return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ;
+ final String profileOpt;
+ if( isGLES() ) {
+ profileOpt = ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : S_EMPTY;
+ } else if( isGLCoreProfile() ) {
+ profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " core" : S_EMPTY;
+ } else if( isGLCompatibilityProfile() ) {
+ profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " compatibility" : S_EMPTY;
+ } else {
+ throw new InternalError("Neither ES, Core nor Compat: "+this); // see validateProfileBits(..)
+ }
+ return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + profileOpt + "\n" ;
}
protected static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions) {