diff options
author | Sven Gothel <[email protected]> | 2012-10-29 11:54:17 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-29 11:54:17 +0100 |
commit | edb04d01099135ac400cd9d84bda6d0b6ca56953 (patch) | |
tree | 17e3f0ccb1d3b2be821bdcf896e7769ddcd232f6 /src/test/com/jogamp/opengl | |
parent | a192426862ad6f05c3351dbaf9880d00707c01bc (diff) |
GLSL Unit tests .. make them all GLSL version proof
Diffstat (limited to 'src/test/com/jogamp/opengl')
18 files changed, 87 insertions, 20 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp index 02efa1522..3210762b1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.fp @@ -1,5 +1,5 @@ -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define varying in out vec4 mgl_FragColor; #else @@ -18,7 +18,7 @@ varying vec4 frontColor; void main (void) { - gl_FragColor = frontColor; + mgl_FragColor = frontColor; if( pointSmooth > 0.5 ) { // smooth (AA) diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp index 873b1f834..4fa49b901 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/PointsShader.vp @@ -1,5 +1,5 @@ -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define attribute in #define varying out #endif diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.fp index 7cf059bae..9a31e2bb5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.fp @@ -1,6 +1,6 @@ // Copyright 2010 JogAmp Community. All rights reserved. -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define varying in out vec4 mgl_FragColor; #else diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.vp index 2b19f3251..9283dd7bd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.vp @@ -1,6 +1,6 @@ // Copyright 2010 JogAmp Community. All rights reserved. -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define attribute in #define varying out #endif diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader2.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader2.fp index e0b92db3b..40a21a1a3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader2.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader2.fp @@ -1,6 +1,6 @@ // Copyright 2010 JogAmp Community. All rights reserved. -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define varying in out vec4 mgl_FragColor; #else diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/default.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/default.vp index 99ad6e400..2037086f1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/default.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/default.vp @@ -1,5 +1,10 @@ //Copyright 2010 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif + #ifdef GL_ES #define MEDIUMP mediump #define HIGHP highp diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp index 22fb65e90..2414af5dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp @@ -9,6 +9,13 @@ * author: Dominik Stroehlein (DemoscenePassivist) **/ +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + #ifdef GL_ES precision mediump float; precision mediump sampler2D; @@ -343,7 +350,7 @@ void main() { color = raymarch_orbittrap_image(oglFragCoord.xy); } if (en==2 || en==7) { - gl_FragColor = color; + mgl_FragColor = color; } else { //do normal rendering ... //analog-tv distortion ... @@ -376,6 +383,6 @@ void main() { //tv flicker effect color_tv *= 0.97+0.13*sin(2.5*tm); color_tv *= br; - gl_FragColor = vec4(color_tv,1.0); + mgl_FragColor = vec4(color_tv,1.0); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp index d3df81994..ce0b8f5aa 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp @@ -12,6 +12,13 @@ //When I wrote this, only God and I understood what I was doing ... // ... now only God knows! X-) +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + uniform int en; uniform float et; uniform sampler2D fb; @@ -209,7 +216,7 @@ void main() { } else n=D(c.xy); if(en==2||en==7) - gl_FragColor=n; + mgl_FragColor=n; else { vec2 i=c.xy/v.xy; i.y*=-1.; @@ -229,6 +236,6 @@ void main() { x*=.9+.1*sin(1.5*tm+i.y*1000.); x*=.97+.13*sin(2.5*tm); x*=br; - gl_FragColor=vec4(x,1.); + mgl_FragColor=vec4(x,1.); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.fp index b8e9e0eee..14328dc1e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.fp @@ -1,7 +1,7 @@ // Copyright (C) 2011 JogAmp Community. All rights reserved. // Details see GearsES2.java -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define varying in out vec4 mgl_FragColor; #else diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.vp index e3a84b257..24f4f9c52 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/gears.vp @@ -1,7 +1,7 @@ // Copyright (C) 2011 JogAmp Community. All rights reserved. // Details see GearsES2.java -#if __VERSION__ >= 140 +#if __VERSION__ >= 130 #define attribute in #define varying out #endif diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.fp index a26dc9737..a2abf9e2c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.fp @@ -1,10 +1,16 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + varying vec4 frontColor; void main (void) { - gl_FragColor = frontColor; - // gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); + mgl_FragColor = frontColor; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.vp index 097a73e4c..98e7916ab 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/mgl_default_xxx.vp @@ -1,5 +1,9 @@ //Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif uniform mat4 mgl_PMVMatrix[2]; // P, Mv attribute vec4 mgl_Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/ruler.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/ruler.fp index b2f4d7a6a..f16a3eeb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/ruler.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/ruler.fp @@ -1,5 +1,12 @@ //Copyright 2010 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + #ifdef GL_ES #define MEDIUMP mediump #define HIGHP highp @@ -19,7 +26,7 @@ void main (void) { MEDIUMP vec2 c = step( onev2, mod(gl_FragCoord.xy, gcu_RulerPixFreq) ); if( c.s == 0.0 || c.t == 0.0 ) { - gl_FragColor = vec4(gcu_RulerColor, 1.0); + mgl_FragColor = vec4(gcu_RulerColor, 1.0); } else { discard; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.fp index adde23d0a..5e7bd2879 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.fp @@ -1,5 +1,12 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + varying vec2 mgl_texCoord; varying vec4 frontColor; @@ -17,6 +24,6 @@ void main (void) } // mix frontColor with texture .. - gl_FragColor = vec4(frontColor*texColor); + mgl_FragColor = vec4(frontColor*texColor); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.vp index c521e3757..1030dab47 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texsequence_xxx.vp @@ -1,5 +1,10 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif + uniform mat4 mgl_PMVMatrix[2]; // uniform mat4 mgl_STMatrix; attribute vec4 mgl_Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp index 1a4254163..4cf1d9d10 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp @@ -1,5 +1,12 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + varying vec2 mgl_texCoord; varying vec4 frontColor; @@ -15,6 +22,6 @@ void main (void) } // mix frontColor with texture .. - gl_FragColor = vec4(frontColor*texColor); + mgl_FragColor = vec4(frontColor*texColor); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp index c521e3757..1030dab47 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp @@ -1,5 +1,10 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define attribute in + #define varying out +#endif + uniform mat4 mgl_PMVMatrix[2]; // uniform mat4 mgl_STMatrix; attribute vec4 mgl_Vertex; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture02_xxx.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture02_xxx.fp index d222606cd..e15d7a154 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture02_xxx.fp +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture02_xxx.fp @@ -1,5 +1,12 @@ // Copyright 2012 JogAmp Community. All rights reserved. +#if __VERSION__ >= 130 + #define varying in + out vec4 mgl_FragColor; +#else + #define mgl_FragColor gl_FragColor +#endif + varying vec2 mgl_texCoord; varying vec4 frontColor; @@ -13,8 +20,8 @@ void main (void) vec4 texColor0 = texture2D(mgl_Texture0, mgl_texCoord); vec4 texColor1 = texture2D(mgl_Texture1, mgl_texCoord); - // gl_FragColor = ( ( texColor0 + texColor1 ) / 2.0 ) * frontColor; - // gl_FragColor = mix(texColor0, texColor1, One/2.0) * frontColor; - gl_FragColor = min(One, mix(texColor0, texColor1, One/2.0) * 1.6) * frontColor; + // mgl_FragColor = ( ( texColor0 + texColor1 ) / 2.0 ) * frontColor; + // mgl_FragColor = mix(texColor0, texColor1, One/2.0) * frontColor; + mgl_FragColor = min(One, mix(texColor0, texColor1, One/2.0) * 1.6) * frontColor; } |