summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-24 17:08:25 +0200
committerSven Gothel <[email protected]>2012-10-24 17:08:25 +0200
commit0f198907181396c5aab545f621098ed2f210003a (patch)
tree260679d4dfa99f05d9c1dc8fd12de3301847e8d8 /src/jogl/classes/jogamp
parentf2661adf587390a61cbb7fe2e3377da2d57672a7 (diff)
GLContext: Produce and expose GLSL version as VersionNumber and version string (for shader programs)
Uses GL_SHADING_LANGUAGE_VERSION and parses it via VersionNumber, as well as having a static fallback using the GL context version. The value is valid and can be retrieved after ctx has been made current once.
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 249dc9c62..d2e0bb407 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -60,6 +60,7 @@ import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
@@ -971,7 +972,22 @@ public abstract class GLContextImpl extends GLContext {
ctxMinorVersion = minor;
ctxOptions = ctp;
if(setVersionString) {
- ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, getGL().glGetString(GL.GL_VERSION));
+ ctxVersionString = getGLVersion(ctxMajorVersion, ctxMinorVersion, ctxOptions, gl.glGetString(GL.GL_VERSION));
+ ctxGLSLVersion = null;
+ if(ctxMajorVersion >= 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 ..
+ }
+ }
+ }
+ if( null == ctxGLSLVersion ){
+ final int[] sver = new int[2];
+ getStaticGLSLVersionNumber(ctxMajorVersion, ctxMinorVersion, ctxOptions, sver);
+ ctxGLSLVersion = new VersionNumber(sver[0], sver[1], 0);
+ }
}
}