diff options
author | Sven Gothel <[email protected]> | 2014-03-25 16:39:18 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-25 16:39:18 +0100 |
commit | b078f74cc707e7fc962efde08ab5d9cc6667e27c (patch) | |
tree | 45bf4859811d1be08a027ce0199d0e2ca6a6c6f2 /src/jogl/classes/jogamp | |
parent | ec5724493bb9398134553a7354e08497e778a9cb (diff) |
Bug 801: Graph OpenGL ES2 and ES3 Compatibility
- Remove 'const' qualifier in shader graph code for non 'absolute' const values
- Use extension directive OES_standard_derivatives only for ES2.0, not ES3.0 (graph shader)
- Compare float w/ float literals, not int literals!
- Android Demo NEWTGraphUI2pActivity:
- Is a VBAA example, hence disable scene MSAA!
Diffstat (limited to 'src/jogl/classes/jogamp')
21 files changed, 152 insertions, 153 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 1288910fb..9a5ed62d8 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -69,7 +69,7 @@ public class RegionRendererImpl01 extends RegionRenderer { rsVp.defaultShaderCustomization(gl, true, true); // rsFp.defaultShaderCustomization(gl, true, true); int pos = rsFp.addGLSLVersion(gl); - if( gl.isGLES() ) { + if( gl.isGLES2() && ! gl.isGLES3() ) { pos = rsFp.insertShaderSource(0, pos, ShaderCode.createExtensionDirective(GLExtensions.OES_standard_derivatives, ShaderCode.ENABLE)); } final String rsFpDefPrecision = getFragmentShaderPrecision(gl); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp index 0d49c2a7f..fba66c398 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp @@ -22,7 +22,7 @@ void main (void) vec3 color; float alpha; - if( 0 < gcu_TextureSize.z ) { + if( 0.0 < gcu_TextureSize.z ) { // Pass-2: Dump Texture vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st); #if 0 diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp index b78e11585..e573bb347 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp @@ -22,7 +22,7 @@ void main (void) vec3 color; float alpha; - if( 0 < gcu_TextureSize.z ) { + if( 0.0 < gcu_TextureSize.z ) { // Pass-2: Dump Texture vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st); #if 0 diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp index 795215285..cca67a219 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp @@ -26,7 +26,7 @@ void main (void) // Note: gcu_Alpha is multiplied in pass2! - if( 0 < gcu_TextureSize.z ) { + if( 0.0 < gcu_TextureSize.z ) { // Quality: allsamples > [flipquad,rgss, quincunx] > poles #include curverenderer01-pass2-vbaa_allsamples_equal.glsl diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp index e303f5c1b..e4dca15cb 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp @@ -26,7 +26,7 @@ void main (void) // Note: gcu_Alpha is multiplied in pass2! - if( 0 < gcu_TextureSize.z ) { + if( 0.0 < gcu_TextureSize.z ) { // Quality: allsamples > [flipquad,rgss, quincunx] > poles #include curverenderer01-pass2-vbaa_allsamples_equal.glsl diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl index 16dda5947..770ab3d71 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl @@ -3,13 +3,13 @@ if( gcv_TexCoord.z > 0.0 ) { // pass-1: AA Lines #if 1 - // const float dist = sqrt( gcv_TexCoord.x*gcv_TexCoord.x + gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude - const float dist = sqrt( gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude - // const float a = 1.0 - smoothstep (gcv_TexCoord.y-gcv_TexCoord.z, gcv_TexCoord.y, dist); - const float r = gcv_TexCoord.x/3.0; - const float wa = gcv_TexCoord.x+r; - const float waHalf = wa/2.0; - const float a = 1.0 - smoothstep (waHalf-2.0*r, waHalf, dist); + // float dist = sqrt( gcv_TexCoord.x*gcv_TexCoord.x + gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude + float dist = sqrt( gcv_TexCoord.y*gcv_TexCoord.y ); // magnitude + // float a = 1.0 - smoothstep (gcv_TexCoord.y-gcv_TexCoord.z, gcv_TexCoord.y, dist); + float r = gcv_TexCoord.x/3.0; + float wa = gcv_TexCoord.x+r; + float waHalf = wa/2.0; + float a = 1.0 - smoothstep (waHalf-2.0*r, waHalf, dist); color = vec3(0, 0, 1.0); // gcu_ColorStatic.rgb; alpha = a; #else diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl index df53db686..cfa1b9000 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl @@ -6,13 +6,13 @@ alpha = 1.0; } else { // pass-1: curves - const vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 ); + vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 ); - const vec2 dtx = dFdx(rtex); - const vec2 dty = dFdy(rtex); + vec2 dtx = dFdx(rtex); + vec2 dty = dFdy(rtex); - const vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); - const float position = rtex.y - (rtex.x * (1.0 - rtex.x)); + vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); + float position = rtex.y - (rtex.x * (1.0 - rtex.x)); // color = vec3(1.0, 0, 0); color = gcu_ColorStatic.rgb; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl index 325ddee01..f73f24f12 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl @@ -16,11 +16,11 @@ } else { rtex.y = max(rtex.y, 0.0); // always >= 0 - const vec2 dtx = dFdx(rtex); - const vec2 dty = dFdy(rtex); + vec2 dtx = dFdx(rtex); + vec2 dty = dFdy(rtex); - const vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); - const float position = rtex.y - (rtex.x * (1.0 - rtex.x)); + vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x)); + float position = rtex.y - (rtex.x * (1.0 - rtex.x)); color = gcu_ColorStatic.rgb; alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl index a489949b4..21e44a23f 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl @@ -5,19 +5,19 @@ alpha = 1.0; } else { // pass-1: curves - const vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 ); + vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 ); - const vec2 dtx = dFdx(rtex); - const vec2 dty = dFdy(rtex); + vec2 dtx = dFdx(rtex); + vec2 dty = dFdy(rtex); - const float w = gcu_Weight; - const float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0; - const float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd); + float w = gcu_Weight; + float pd = ((2.0 - (2.0*w))*rtex.x*rtex.x) + 2.0*(w-1.0)*rtex.x + 1.0; + float position = rtex.y - ((w*rtex.x*(1.0 - rtex.x))/pd); - const float aph = 2.0 - 2.0*w; + float aph = 2.0 - 2.0*w; - const float gd = (aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0)*(aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0); - const vec2 f = vec2((dtx.y - (w*dtx.x*(1.0 - 2.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd)); + float gd = (aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0)*(aph*rtex.x*rtex.x + 2.0*rtex.x + 1.0); + vec2 f = vec2((dtx.y - (w*dtx.x*(1.0 - 2.0*rtex.x))/gd), (dty.y - (w*dty.x*(1.0 - 2.0*rtex.x))/gd)); color = gcu_ColorStatic.rgb; alpha = clamp(0.5 - ( position/length(f) ) * sign(gcv_TexCoord.y), 0.0, 1.0); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl index 068341b25..1d2451755 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl @@ -1,15 +1,14 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Not only the poles (NW, SW, ..) but the whole edge! - const float sample_weight = 1 / ( sampleCount * sampleCount ); + float sample_weight = 1.0 / ( sampleCount * sampleCount ); // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025); - - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; vec4 t; @@ -18,7 +17,7 @@ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE - if( sampleCount > 2 ) { + if( sampleCount > 2.0 ) { // SampleCount 4 -> +12x = 16p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight; @@ -33,7 +32,7 @@ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; // t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed) - if( sampleCount > 4 ) { + if( sampleCount > 4.0 ) { // SampleCount 6 -> +20x = 36p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight; @@ -55,7 +54,7 @@ t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight; t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight; t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed) - if( sampleCount > 6 ) { + if( sampleCount > 6.0 ) { // SampleCount 8 -> +28x = 64p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl index 76227eba3..79c89a444 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl @@ -1,31 +1,31 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Not only the poles (NW, SW, ..) but the whole edge! - const float pixelCount = sampleCount * sampleCount; + float pixelCount = sampleCount * sampleCount; // sampleCount [0, 1, 3, 5, 7] are undefined! - const float layerCount = ( sampleCount / 2.0 ); + float layerCount = ( sampleCount / 2.0 ); // sum of all integer [layerCount .. 1] -> Gauss - const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); + float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; - vec4 t = vec4(0); + vec4 t; // Layer-1: SampleCount 2 -> 4x - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW + t = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1 - if( sampleCount > 2 ) { + if( sampleCount > 2.0 ) { // Layer-2: SampleCount 4 -> +12x = 16p vec4 tn = vec4(0); tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW -> SW Edge @@ -43,7 +43,7 @@ t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2 - if( sampleCount > 4 ) { + if( sampleCount > 4.0 ) { // Layer-3: SampleCount 6 -> +20x = 36p tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW -> SW Edge tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5))); @@ -68,7 +68,7 @@ t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3 - if( sampleCount > 6 ) { + if( sampleCount > 6.0 ) { // Layer-4: SampleCount 8 -> +28x = 64p tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW -> SW Edge tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5))); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl index 1ee29de77..b5c1494f8 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl @@ -2,29 +2,29 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left! - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Just poles (NW, SW, ..) - const float edge1H = sampleCount / 2.0; - const float edge1T = sampleCount / 3.0; - const float edgeTH = edge1H-edge1T; + float edge1H = sampleCount / 2.0; + float edge1T = sampleCount / 3.0; + float edgeTH = edge1H-edge1T; - const vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 - const vec2 modPos = mod(normFragCoord, 2.0); - const float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) + vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 + vec2 modPos = mod(normFragCoord, 2.0); + float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) - const vec2 texCoord = gcv_TexCoord.st; - vec4 t = vec4(0); + vec2 texCoord = gcv_TexCoord.st; + vec4 t; - if( 0 == orient ) { + if( 0.0 == orient ) { // SWIPE LEFT -> RIGHT - t += GetSample(gcu_TextureUnit, texCoord, psize, -edge1H, edgeTH, 0.0, 0.0)*0.25; // upper-left [p1] + t = GetSample(gcu_TextureUnit, texCoord, psize, -edge1H, edgeTH, 0.0, 0.0)*0.25; // upper-left [p1] t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeTH, -edge1H, 0.0, 0.0)*0.25; // lower-left [p3] t += GetSample(gcu_TextureUnit, texCoord, psize, edgeTH, edge1H, 0.0, 0.0)*0.25; // upper-right [p2] t += GetSample(gcu_TextureUnit, texCoord, psize, edge1H, -edgeTH, 0.0, 0.0)*0.25; // lower-right [p4] } else { - t += GetSample(gcu_TextureUnit, texCoord, psize, -edge1H, -edgeTH, 0.0, 0.0)*0.25; // lower-left [p4] + t = GetSample(gcu_TextureUnit, texCoord, psize, -edge1H, -edgeTH, 0.0, 0.0)*0.25; // lower-left [p4] t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeTH, edge1H, 0.0, 0.0)*0.25; // upper-left [p3] t += GetSample(gcu_TextureUnit, texCoord, psize, edgeTH, -edge1H, 0.0, 0.0)*0.25; // lower-right [p2] t += GetSample(gcu_TextureUnit, texCoord, psize, edge1H, edgeTH, 0.0, 0.0)*0.25; // upper-right [p1] diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl index 279269ed6..98812861d 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl @@ -4,28 +4,28 @@ // // Same as flipquad - but w/ rgss coordinates - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size - const vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 - const vec2 modPos = mod(normFragCoord, 2.0); - const float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) + vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 + vec2 modPos = mod(normFragCoord, 2.0); + float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) - const vec2 texCoord = gcv_TexCoord.st; - const float edge1Q = ( sampleCount / 2.0 ) - 1.0; + vec2 texCoord = gcv_TexCoord.st; + float edge1Q = ( sampleCount / 2.0 ) - 1.0; - vec4 t = vec4(0); + vec4 t; // #define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY)) - if( 0 == orient ) { + if( 0.0 == orient ) { // SWIPE LEFT -> RIGHT - t += GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1] + t = GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edge1Q, -0.5, -0.5)*0.25; // lower-left [p3] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edge1Q, 0.5, 0.5)*0.25; // upper-right [p2] t += GetSample(gcu_TextureUnit, texCoord, psize, edge1Q, 0.0, 0.5, -0.5)*0.25; // lower-right [p4] } else { - t += GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, -0.5)*0.25; // lower-left [p4] + t = GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, -0.5)*0.25; // lower-left [p4] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edge1Q, -0.5, 0.5)*0.25; // upper-left [p3] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edge1Q, 0.5, -0.5)*0.25; // lower-right [p2] t += GetSample(gcu_TextureUnit, texCoord, psize, edge1Q, 0.0, 0.5, 0.5)*0.25; // upper-right [p1] diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl index 2882db4de..edfbd9deb 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl @@ -4,35 +4,35 @@ // // Same as flipquad - but w/ rgss coordinates - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size - const vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 - const vec2 modPos = mod(normFragCoord, 2.0); - const float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) + vec2 normFragCoord = gl_FragCoord.xy - vec2(0.5, 0.5); // normalize center 0.5/0.5 -> 0/0 + vec2 modPos = mod(normFragCoord, 2.0); + float orient = mod(modPos.x + modPos.y, 2.0); // mirrored on all odd columns, alternating each row (checker-board pattern) - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; vec4 t; // #define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY)) - if( 1 == sampleCount ) { + if( 1.0 == sampleCount ) { t = texture2D(gcu_TextureUnit, texCoord); - } else if( 4 > sampleCount ) { + } else if( 4.0 > sampleCount ) { // SampleCount 2 -> 2p const float weight = 1.0 / 2.0; - const float edge = ( sampleCount / 2.0 ) - 1.0; + float edge = ( sampleCount / 2.0 ) - 1.0; t = GetSample(gcu_TextureUnit, texCoord, psize, -edge, edge, -0.5, 0.5)*weight; // center t += GetSample(gcu_TextureUnit, texCoord, psize, edge, -edge, 0.5, -0.5)*weight; // center - } else if( 8 > sampleCount ) { + } else if( 8.0 > sampleCount ) { // SampleCount 4 -> 4p const float weight = 1.0 / 4.0; - const float edgeS4_1Q = ( sampleCount / 2.0 ) - 1.0; + float edgeS4_1Q = ( sampleCount / 2.0 ) - 1.0; - if( 0 == orient ) { + if( 0.0 == orient ) { // SWIPE LEFT -> RIGHT t = GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, -0.5, 0.5)*weight; // upper-left [p1] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, -0.5, -0.5)*weight; // lower-left [p3] @@ -49,7 +49,7 @@ const float weight = 1.0 / 16.0; const float edgeS4_1Q = 1.0; - if( 0 == orient ) { + if( 0.0 == orient ) { // SWIPE LEFT -> RIGHT t = GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, -2.0+0.5)*weight; // upper-left [p1] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0-0.5, -2.0-0.5)*weight; // lower-left [p3] diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl index d27d9df12..6a2040577 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl @@ -2,46 +2,46 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - if( gcu_TextureSize.z < 4 ) { + if( gcu_TextureSize.z < 4.0 ) { // FXAA-2 const float FXAA_REDUCE_MIN = (1.0/128.0); const float FXAA_REDUCE_MUL = (1.0/8.0); const float FXAA_SPAN_MAX = 8.0; - const float sampleCount = gcu_TextureSize.z; + float sampleCount = gcu_TextureSize.z; - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; const float poff = 1.0; - const vec2 psize = 1.0 / texCoord; // pixel size + vec2 psize = 1.0 / texCoord; // pixel size - const vec3 rgbNW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, -poff))).rgb; - const vec3 rgbSW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, poff))).rgb; - const vec3 rgbSE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, poff))).rgb; - const vec3 rgbNE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, -poff))).rgb; - const vec4 rgbM = texture2D(gcu_TextureUnit, texCoord); + vec3 rgbNW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, -poff))).rgb; + vec3 rgbSW = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-poff, poff))).rgb; + vec3 rgbSE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, poff))).rgb; + vec3 rgbNE = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( poff, -poff))).rgb; + vec4 rgbM = texture2D(gcu_TextureUnit, texCoord); const vec3 luma = vec3(0.299, 0.587, 0.114); - const float lumaNW = dot(rgbNW, luma); - const float lumaNE = dot(rgbNE, luma); - const float lumaSW = dot(rgbSW, luma); - const float lumaSE = dot(rgbSE, luma); - const float lumaM = dot(rgbM.rgb, luma); - const float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); - const float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); + float lumaNW = dot(rgbNW, luma); + float lumaNE = dot(rgbNE, luma); + float lumaSW = dot(rgbSW, luma); + float lumaSE = dot(rgbSE, luma); + float lumaM = dot(rgbM.rgb, luma); + float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); + float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); vec2 dir; dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); - const float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),FXAA_REDUCE_MIN); - const float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce); + float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),FXAA_REDUCE_MIN); + float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce); dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX), max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),dir * rcpDirMin) ) * psize; - const vec3 rgbA = 0.5 * ( texture2D(gcu_TextureUnit, texCoord + dir * (1.0/3.0 - 0.5)).rgb + - texture2D(gcu_TextureUnit, texCoord + dir * (2.0/3.0 - 0.5)).rgb ); - const vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(gcu_TextureUnit, texCoord + (dir * - 0.5)).rgb + - texture2D(gcu_TextureUnit, texCoord + (dir * 0.5)).rgb ); - const float lumaB = dot(rgbB, luma); + vec3 rgbA = 0.5 * ( texture2D(gcu_TextureUnit, texCoord + dir * (1.0/3.0 - 0.5)).rgb + + texture2D(gcu_TextureUnit, texCoord + dir * (2.0/3.0 - 0.5)).rgb ); + vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(gcu_TextureUnit, texCoord + (dir * - 0.5)).rgb + + texture2D(gcu_TextureUnit, texCoord + (dir * 0.5)).rgb ); + float lumaB = dot(rgbB, luma); if((lumaB < lumaMin) || (lumaB > lumaMax)) { color = rgbA; } else { diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl index f582ee8a2..08475317e 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl @@ -1,11 +1,11 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; - const float sampleCount = gcu_TextureSize.z; - const vec2 tsize = gcu_TextureSize.xy; // tex size - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 tsize = gcu_TextureSize.xy; // tex size + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // mix(x,y,a): x*(1-a) + y*a // @@ -17,16 +17,16 @@ // // so we can use the build in mix function for these 2 computations ;-) // - const vec2 uv_ratio = fract(texCoord*tsize); // texCoord*tsize - floor(texCoord*tsize); + vec2 uv_ratio = fract(texCoord*tsize); // texCoord*tsize - floor(texCoord*tsize); // Just poles (NW, SW, ..) - const float pixelCount = 2 * sampleCount; + float pixelCount = 2 * sampleCount; // sampleCount [0, 1, 3, 5, 7] are undefined! - const float layerCount = ( sampleCount / 2.0 ); + float layerCount = ( sampleCount / 2.0 ); // sum of all integer [layerCount .. 1] -> Gauss - const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); + float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); vec4 t, p1, p2, p3, p4; @@ -42,7 +42,7 @@ t *= (layerCount - 0.0) / ( denom ); // weight layer 1 - if( sampleCount > 2 ) { + if( sampleCount > 2.0 ) { // Layer-2: SampleCount 4 -> +4x = 8p p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW @@ -54,7 +54,7 @@ p3 = mix ( p1, p2, uv_ratio.y ); t += p3 * (layerCount - 1) / ( denom ); // weight layer 2 - if( sampleCount > 4 ) { + if( sampleCount > 4.0 ) { // Layer-3: SampleCount 6 -> +4 = 12p p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW @@ -66,7 +66,7 @@ p3 = mix ( p1, p2, uv_ratio.y ); t += p3 * (layerCount - 2) / ( denom ); // weight layer 3 - if( sampleCount > 6 ) { + if( sampleCount > 6.0 ) { // Layer-4: SampleCount 8 -> +4 = 16p p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl index d1efb1206..a03294034 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl @@ -2,35 +2,35 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Just poles (NW, SW, ..) - const float sample_weight = 1 / ( 2 * sampleCount ); + float sample_weight = 1 / ( 2 * sampleCount ); - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; - vec4 t = vec4(0); + vec4 t; // SampleCount 2 -> 4x - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW + t = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE - if( sampleCount > 2 ) { + if( sampleCount > 2.0 ) { // SampleCount 4 -> +4 = 8p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE - if( sampleCount > 4 ) { + if( sampleCount > 4.0 ) { // SampleCount 6 -> +4 = 12p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE - if( sampleCount > 6 ) { + if( sampleCount > 6.0 ) { // SampleCount 8 -> +4 = 16p t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl index 3459e3da6..d63dda7cc 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl @@ -1,31 +1,31 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels. - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Just poles (NW, SW, ..) - const float pixelCount = 2 * sampleCount; + float pixelCount = 2 * sampleCount; // sampleCount [0, 1, 3, 5, 7] are undefined! - const float layerCount = ( sampleCount / 2.0 ); + float layerCount = ( sampleCount / 2.0 ); // sum of all integer [layerCount .. 1] -> Gauss - const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); + float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; - vec4 t = vec4(0); + vec4 t; // Layer-1: SampleCount 2 -> 4x - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW + t = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1 - if( sampleCount > 2 ) { + if( sampleCount > 2.0 ) { // Layer-2: SampleCount 4 -> +4x = 8p vec4 tn = vec4(0); tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW @@ -35,7 +35,7 @@ t += tn * (layerCount - 1) / ( denom * 4.0 ); // weight layer 2 - if( sampleCount > 4 ) { + if( sampleCount > 4.0 ) { // Layer-3: SampleCount 6 -> +4 = 12p tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW @@ -44,7 +44,7 @@ t += tn * (layerCount - 2) / ( denom * 4.0 ); // weight layer 3 - if( sampleCount > 6 ) { + if( sampleCount > 6.0 ) { // Layer-4: SampleCount 8 -> +4 = 16p tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl index 2fe4faaff..545f1cc82 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl @@ -2,17 +2,17 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left! - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size // Just poles (NW, SW, ..) - const float edgeH = sampleCount / 2.0; + float edgeH = sampleCount / 2.0; - const vec2 texCoord = gcv_TexCoord.st; + vec2 texCoord = gcv_TexCoord.st; - vec4 t = vec4(0); + vec4 t; - t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, 0.0, 0.0, 0.0)*0.5; // w1 - center + t = GetSample(gcu_TextureUnit, texCoord, psize, 0.0, 0.0, 0.0, 0.0)*0.5; // w1 - center t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeH, -edgeH, 0.0, 0.0)*0.125; // w2 - sharing t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeH, edgeH, 0.0, 0.0)*0.125; // w3 - edges t += GetSample(gcu_TextureUnit, texCoord, psize, edgeH, -edgeH, 0.0, 0.0)*0.125; // w4 - w/ all pixels diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl index fc847e08f..804ab6013 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl @@ -2,15 +2,15 @@ // Pass-2: AA on Texture // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left! - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + float sampleCount = gcu_TextureSize.z; + vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size - const vec2 texCoord = gcv_TexCoord.st; - const float edge1Q = ( sampleCount / 2.0 ) - 1.0; + vec2 texCoord = gcv_TexCoord.st; + float edge1Q = ( sampleCount / 2.0 ) - 1.0; - vec4 t = vec4(0); + vec4 t; // SWIPE LEFT -> RIGHT - t += GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1] + t = GetSample(gcu_TextureUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edge1Q, -0.5, -0.5)*0.25; // lower-left [p3] t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edge1Q, 0.5, 0.5)*0.25; // upper-right [p2] t += GetSample(gcu_TextureUnit, texCoord, psize, edge1Q, 0.0, 0.5, -0.5)*0.25; // lower-right [p4] diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp index b3c9ebd35..5ab82ad40 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp @@ -14,7 +14,7 @@ void main(void) // gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_Vertices, 1); gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * gca_Vertices; if( gcv_TexCoord.x <= -10.0 ) { - // const vec4 tc = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_TexCoords.xy, gca_Vertices.z, 1); + // vec4 tc = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_TexCoords.xy, gca_Vertices.z, 1); // gcv_TexCoord = vec3(tc.xy, gca_TexCoords.z); gcv_TexCoord = gca_TexCoords; } else { |