summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-04-01 16:31:05 +0200
committerSven Gothel <[email protected]>2014-04-01 16:31:05 +0200
commitb935d5248aef79e2386a284b32f5888348a382d6 (patch)
tree6b661210ee531968fcf7d5c75ded4ed58bd3b0fc /src/jogl/classes/jogamp/graph/curve
parent07d1c5a272e528d130daf37b9aa7077aac8d748e (diff)
Bug 801: WIP 1/2 - Add color attribute; Switch Shader instead of branching in shader; Update attributes and uniforms manually, drop ShaderState;
- ShaderCode - add int insertShaderSource(int shaderIdx, int position, Class<?> context, String path) - insertShaderSource(..): pos==-1 -> append code - VectorUtil - add isVec3InTriangle3(..., float epsilon) - add testSeg2SegIntersection(..., float epsilon) - add testTri2SegIntersection(..., float epsilon) - AffineTransform: Return result for chaining - Font - Add pixel precise 'getPointsBounds(final AffineTransform transform, CharSequence string, float pixelSize)' - Rename getString*() -> getMetric*() - OTGlyph: Release _points field, no more used - - Graph Triangulation - Count additional vertices in: Triangulator, CDTriangulator2D - OutlineShape: - Allow skipping of 'transformOutlines2Quadratic', i.e. allow tagging OutlineShape to be quadratic_nurbs via 'setIsQuadraticNurbs()' - Clarify cleanup ot outlines in same method 'cleanupOutlines()' - Count additional vertices .. - Graph Shader: - Start splitting and segmenting shader code for: - pass1 / pass2 - features, i.e. sampleCont, color-channel, ..
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java106
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java73
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java311
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java341
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java142
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java18
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java9
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl16
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp5
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp5
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa-weight.fp13
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_msaa.fp20
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp17
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl20
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl32
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl25
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_lineAA.glsl19
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl26
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl37
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl32
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp30
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl96
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl113
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl97
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl114
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad.glsl27
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad2.glsl27
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_flipquad3.glsl129
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_fxaa3.glsl32
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_bilin1.glsl45
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl50
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl66
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl49
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl65
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_quincunx.glsl21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_rgss.glsl19
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2.vp17
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-segment-head.fp22
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp30
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp23
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl15
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl9
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java11
45 files changed, 1219 insertions, 1186 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
deleted file mode 100644
index 9a5ed62d8..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package jogamp.graph.curve.opengl;
-
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-
-import jogamp.graph.curve.opengl.shader.AttributeNames;
-import jogamp.opengl.Debug;
-
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.opengl.GLExtensions;
-import com.jogamp.opengl.util.glsl.ShaderCode;
-import com.jogamp.opengl.util.glsl.ShaderProgram;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class RegionRendererImpl01 extends RegionRenderer {
- private static final String CUSTOM_FP, CUSTOM_VP;
- static {
- Debug.initSingleton();
- CUSTOM_VP = Debug.getProperty("jogl.debug.graph.curve.vp", false);
- CUSTOM_FP = Debug.getProperty("jogl.debug.graph.curve.fp", false);
- }
-
- public RegionRendererImpl01(final RenderState rs, final int renderModes, final GLCallback enableCallback, final GLCallback disableCallback) {
- super(rs, renderModes, enableCallback, disableCallback);
- }
-
- @Override
- protected final boolean initImpl(GL2ES2 gl) {
- final ShaderState st = getShaderState();
- final ShaderCode rsVp, rsFp;
- if( null != CUSTOM_VP ) {
- rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, null, null, CUSTOM_VP, true);
- } else {
- rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader", "shader/bin", getVertexShaderName(), true);
- }
- if( null != CUSTOM_FP ) {
- rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, null, null, CUSTOM_FP, true);
- } else {
- rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader", "shader/bin", getFragmentShaderName(), true);
- }
- rsVp.defaultShaderCustomization(gl, true, true);
- // rsFp.defaultShaderCustomization(gl, true, true);
- int pos = rsFp.addGLSLVersion(gl);
- if( gl.isGLES2() && ! gl.isGLES3() ) {
- pos = rsFp.insertShaderSource(0, pos, ShaderCode.createExtensionDirective(GLExtensions.OES_standard_derivatives, ShaderCode.ENABLE));
- }
- final String rsFpDefPrecision = getFragmentShaderPrecision(gl);
- if( null != rsFpDefPrecision ) {
- rsFp.insertShaderSource(0, pos, rsFpDefPrecision);
- }
-
- final ShaderProgram sp = new ShaderProgram();
- sp.add(rsVp);
- sp.add(rsFp);
-
- if( !sp.init(gl) ) {
- throw new GLException("RegionRenderer: Couldn't init program: "+sp);
- }
- st.attachShaderProgram(gl, sp, false);
- st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
-
- if(!sp.link(gl, System.err)) {
- throw new GLException("RegionRenderer: Couldn't link program: "+sp);
- }
- st.useProgram(gl, true);
-
- if(DEBUG) {
- System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
- }
- return true;
- }
-
- @Override
- protected final void destroyImpl(GL2ES2 gl) {
- // NOP .. all will be destroyed via RenderState
- }
-}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
deleted file mode 100644
index 68f926b0a..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package jogamp.graph.curve.opengl;
-
-import java.nio.FloatBuffer;
-
-import javax.media.opengl.GLUniformData;
-
-import jogamp.graph.curve.opengl.shader.UniformNames;
-
-import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.opengl.util.PMVMatrix;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public class RenderStateImpl extends RenderState {
- /**
- * weight is equivalent to the
- * global off-curve vertex weight.
- * TODO: change to per vertex
- */
- private final GLUniformData gcu_Weight;
- private final GLUniformData gcu_Alpha;
- private final GLUniformData gcu_ColorStatic;
-
- public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
- super(st, pointFactory, pmvMatrix);
-
- gcu_Weight = new GLUniformData(UniformNames.gcu_Weight, 1.0f);
- st.ownUniform(gcu_PMVMatrix);
- gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f);
- st.ownUniform(gcu_Alpha);
- gcu_ColorStatic = new GLUniformData(UniformNames.gcu_ColorStatic, 3, FloatBuffer.allocate(3));
- st.ownUniform(gcu_ColorStatic);
-// gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f);
-// st.ownUniform(gcu_Strength);
- }
-
- @Override
- public final GLUniformData getWeight() { return gcu_Weight; }
- @Override
- public final GLUniformData getAlpha() { return gcu_Alpha; }
- @Override
- public final GLUniformData getColorStatic() { return gcu_ColorStatic; }
- //public final GLUniformData getStrength() { return gcu_Strength; }
-
-
-}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index e36f46878..4649a2714 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -33,13 +33,10 @@ import javax.media.opengl.GL2ES2;
// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
import javax.media.opengl.GL;
import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
@@ -48,128 +45,171 @@ import com.jogamp.opengl.FBObject.Attachment;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
-import com.jogamp.opengl.util.glsl.ShaderState;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
public class VBORegion2PMSAAES2 extends GLRegion {
private static final boolean DEBUG_FBO_1 = false;
private static final boolean DEBUG_FBO_2 = false;
- private GLArrayDataServer verticeTxtAttr;
- private GLArrayDataServer texCoordTxtAttr;
- private GLArrayDataServer indicesTxtBuffer;
- private GLArrayDataServer verticeFboAttr;
- private GLArrayDataServer texCoordFboAttr;
+
+ // Pass-1:
+ private GLArrayDataServer gca_VerticesAttr;
+ private GLArrayDataServer gca_CurveParamsAttr;
+ private GLArrayDataServer gca_ColorsAttr;
+ private GLArrayDataServer indicesBuffer;
+ private ShaderProgram spPass1 = null;
+
+ // Pass-2:
+ private GLArrayDataServer gca_FboVerticesAttr;
+ private GLArrayDataServer gca_FboTexCoordsAttr;
private GLArrayDataServer indicesFbo;
+ private final GLUniformData gcu_FboTexUnit;
+ private GLUniformData gcu_FboTexSize;
+ private final PMVMatrix fboPMVMatrix;
+ private final GLUniformData gcu_PMVMatrix02;
+ private boolean gcu_FboTexSize_dirty = true;
+ private boolean gcu_PMVMatrix02_dirty = true;
+ private ShaderProgram spPass2 = null;
private FBObject fbo;
- private final PMVMatrix fboPMVMatrix;
- GLUniformData mgl_fboPMVMatrix;
private int fboWidth = 0;
private int fboHeight = 0;
private boolean fboDirty = true;
- GLUniformData mgl_ActiveTexture;
- GLUniformData mgl_TextureSize;
final int[] maxTexSize = new int[] { -1 } ;
+ public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int renderModes, final boolean pass1, final int quality, final int sampleCount) {
+ final RenderState rs = renderer.getRenderState();
+ final boolean updateLocation0 = renderer.useShaderProgram(gl, renderModes, pass1, quality, sampleCount);
+ final ShaderProgram sp = renderer.getRenderState().getShaderProgram();
+ final boolean updateLocation;
+ if( pass1 ) {
+ updateLocation = !sp.equals(spPass1);
+ spPass1 = sp;
+ rs.update(gl, updateLocation, renderModes, true);
+ if( updateLocation ) {
+ gcu_PMVMatrix02.setLocation(gl, sp.program());
+ }
+ rs.updateAttributeLoc(gl, updateLocation, gca_VerticesAttr);
+ rs.updateAttributeLoc(gl, updateLocation, gca_CurveParamsAttr);
+ if( null != gca_ColorsAttr ) {
+ rs.updateAttributeLoc(gl, updateLocation, gca_ColorsAttr);
+ }
+ System.err.println("XXX changedSP.p1 "+updateLocation+" / "+updateLocation0+", "+rs);
+ } else {
+ updateLocation = !sp.equals(spPass2);
+ spPass2 = sp;
+ rs.update(gl, updateLocation, renderModes, false);
+ rs.updateAttributeLoc(gl, updateLocation, gca_FboVerticesAttr);
+ rs.updateAttributeLoc(gl, updateLocation, gca_FboTexCoordsAttr);
+ rs.updateUniformDataLoc(gl, updateLocation, true, gcu_FboTexSize);
+ if( updateLocation ) {
+ gcu_FboTexSize.setLocation(gl, sp.program());
+ }
+ System.err.println("XXX changedSP.p2 "+updateLocation+" / "+updateLocation0+", "+rs);
+ }
+ }
+
public VBORegion2PMSAAES2(final int renderModes, final int textureUnit) {
super(renderModes);
final int initialElementCount = 256;
- fboPMVMatrix = new PMVMatrix();
- mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
- mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureUnit);
- indicesTxtBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ // Pass 1:
+ indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+
+ gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
+
+ if( hasColorChannel() ) {
+ gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
+ } else {
+ gca_ColorsAttr = null;
+ }
+
+ // Pass 2:
+ fboPMVMatrix = new PMVMatrix();
+ gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix01, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
+ gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, textureUnit);
+
+ indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
+ indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
+ indicesFbo.seal(true);
+
+ gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ false, 4, GL.GL_STATIC_DRAW);
+ gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0);
+ gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1);
+ gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(1);
+ gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0);
+ gca_FboTexCoordsAttr.seal(true);
+
+ gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, 4, GL.GL_STATIC_DRAW);
}
@Override
protected final void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) {
- if( null != indicesTxtBuffer ) {
- indicesTxtBuffer.seal(gl, false);
- indicesTxtBuffer.rewind();
+ if( null != indicesBuffer ) {
+ indicesBuffer.seal(gl, false);
+ indicesBuffer.rewind();
}
- if( null != verticeTxtAttr ) {
- verticeTxtAttr.seal(gl, false);
- verticeTxtAttr.rewind();
+ if( null != gca_VerticesAttr ) {
+ gca_VerticesAttr.seal(gl, false);
+ gca_VerticesAttr.rewind();
}
- if( null != texCoordTxtAttr ) {
- texCoordTxtAttr.seal(gl, false);
- texCoordTxtAttr.rewind();
+ if( null != gca_CurveParamsAttr ) {
+ gca_CurveParamsAttr.seal(gl, false);
+ gca_CurveParamsAttr.rewind();
}
fboDirty = true;
}
@Override
- protected final void pushVertex(float[] coords, float[] texParams) {
- verticeTxtAttr.putf(coords[0]);
- verticeTxtAttr.putf(coords[1]);
- verticeTxtAttr.putf(coords[2]);
-
- texCoordTxtAttr.putf(texParams[0]);
- texCoordTxtAttr.putf(texParams[1]);
- texCoordTxtAttr.putf(texParams[2]);
+ protected final void pushVertex(float[] coords, float[] texParams, float[] color) {
+ gca_VerticesAttr.putf(coords[0]);
+ gca_VerticesAttr.putf(coords[1]);
+ gca_VerticesAttr.putf(coords[2]);
+
+ gca_CurveParamsAttr.putf(texParams[0]);
+ gca_CurveParamsAttr.putf(texParams[1]);
+ gca_CurveParamsAttr.putf(texParams[2]);
}
@Override
protected final void pushIndex(int idx) {
- indicesTxtBuffer.puts((short)idx);
+ indicesBuffer.puts((short)idx);
}
@Override
protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) {
- if(null == indicesFbo) {
- final ShaderState st = renderer.getShaderState();
-
- indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
- indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
- indicesFbo.seal(true);
-
- texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
- false, 4, GL.GL_STATIC_DRAW);
- st.ownAttribute(texCoordFboAttr, true);
- texCoordFboAttr.putf(0); texCoordFboAttr.putf(0);
- texCoordFboAttr.putf(0); texCoordFboAttr.putf(1);
- texCoordFboAttr.putf(1); texCoordFboAttr.putf(1);
- texCoordFboAttr.putf(1); texCoordFboAttr.putf(0);
- texCoordFboAttr.seal(true);
-
- verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, 4, GL.GL_STATIC_DRAW);
- st.ownAttribute(verticeFboAttr, true);
-
- st.ownAttribute(verticeTxtAttr, true);
- st.ownAttribute(texCoordTxtAttr, true);
-
- if(Region.DEBUG_INSTANCE) {
- System.err.println("VBORegion2PMSAAES2 Create: " + this);
- }
- }
// seal buffers
- indicesTxtBuffer.seal(gl, true);
- indicesTxtBuffer.enableBuffer(gl, false);
- texCoordTxtAttr.seal(gl, true);
- texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.seal(gl, true);
- verticeTxtAttr.enableBuffer(gl, false);
+ indicesBuffer.seal(gl, true);
+ indicesBuffer.enableBuffer(gl, false);
+ gca_CurveParamsAttr.seal(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.seal(gl, true);
+ gca_VerticesAttr.enableBuffer(gl, false);
// update all bbox related data
- verticeFboAttr.seal(gl, false);
- verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMaxY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()); verticeFboAttr.putf(box.getMaxY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.seal(gl, true);
- verticeFboAttr.enableBuffer(gl, false);
-
- fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- fboPMVMatrix.glLoadIdentity();
- fboPMVMatrix.glOrthof(box.getMinX(), box.getMaxX(), box.getMinY(), box.getMaxY(), -1, 1);
+ gca_FboVerticesAttr.seal(gl, false);
+ {
+ final FloatBuffer fb = (FloatBuffer)gca_FboVerticesAttr.getBuffer();
+ fb.put( 2, box.getMinZ());
+ fb.put( 5, box.getMinZ());
+ fb.put( 8, box.getMinZ());
+ fb.put(11, box.getMinZ());
+ }
+ // Pending .. (follow fboDirty)
+ // gca_FboVerticesAttr.seal(gl, true);
+ // gca_FboVerticesAttr.enableBuffer(gl, false);
+ // fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ // fboPMVMatrix.glLoadIdentity();
+ // fboPMVMatrix.glOrthof(box.getMinX(), box.getMaxX(), box.getMinY(), box.getMaxY(), -1, 1);
// push data 2 GPU ..
indicesFbo.seal(gl, true);
@@ -187,7 +227,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
@Override
protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) {
- if( 0 >= indicesTxtBuffer.getElementCount() ) {
+ if( 0 >= indicesBuffer.getElementCount() ) {
if(DEBUG_INSTANCE) {
System.err.printf("VBORegion2PMSAAES2.drawImpl: Empty%n");
}
@@ -277,58 +317,51 @@ public class VBORegion2PMSAAES2 extends GLRegion {
final float minY = box.getMinY()-diffObjBorderHeight;
final float maxX = box.getMaxX()+diffObjBorderWidth+diffObjWidth;
final float maxY = box.getMaxY()+diffObjBorderHeight+diffObjHeight;
- verticeFboAttr.seal(false);
+ gca_FboVerticesAttr.seal(false);
{
- final FloatBuffer fb = (FloatBuffer)verticeFboAttr.getBuffer();
+ final FloatBuffer fb = (FloatBuffer)gca_FboVerticesAttr.getBuffer();
fb.put(0, minX); fb.put( 1, minY);
fb.put(3, minX); fb.put( 4, maxY);
fb.put(6, maxX); fb.put( 7, maxY);
fb.put(9, maxX); fb.put(10, minY);
}
- verticeFboAttr.seal(true);
+ gca_FboVerticesAttr.seal(true);
fboPMVMatrix.glLoadIdentity();
fboPMVMatrix.glOrthof(minX, maxX, minY, maxY, -1, 1);
+ gcu_PMVMatrix02_dirty = true;
renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount);
} else {
- texCoordFboAttr.setVBOWritten(false);
+ gca_FboTexCoordsAttr.setVBOWritten(false);
}
// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
renderFBO(gl, rs, vpWidth, vpHeight, sampleCount[0]);
}
}
- private void setTexSize(final GL2ES2 gl, final ShaderState st, final boolean firstPass, final int width, final int height, final int sampleCount) {
- if(null == mgl_TextureSize) {
- mgl_TextureSize = new GLUniformData(UniformNames.gcu_TextureSize, 3, Buffers.newDirectFloatBuffer(3));
- }
- final FloatBuffer texSize = (FloatBuffer) mgl_TextureSize.getBuffer();
- texSize.put(0, width);
- texSize.put(1, height);
- if( firstPass ) {
- texSize.put(2, 0f);
- } else {
- texSize.put(2, 1f+sampleCount);
- }
- st.uniform(gl, mgl_TextureSize);
- }
private void renderFBO(final GL2ES2 gl, final RenderState rs, final int width, final int height, final int sampleCount) {
- final ShaderState st = rs.getShaderState();
-
gl.glViewport(0, 0, width, height);
- st.uniform(gl, mgl_ActiveTexture);
- gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
- setTexSize(gl, st, false, fboWidth, fboHeight, sampleCount);
+
+ if( gcu_FboTexSize_dirty ) {
+ gl.glUniform(gcu_FboTexSize);
+ gcu_FboTexSize_dirty = false;
+ }
+ if( gcu_PMVMatrix02_dirty ) {
+ gl.glUniform(gcu_PMVMatrix02);
+ gcu_PMVMatrix02_dirty = false;
+ }
+
+ gl.glActiveTexture(GL.GL_TEXTURE0 + gcu_FboTexUnit.intValue());
fbo.use(gl, fbo.getSamplingSink());
- verticeFboAttr.enableBuffer(gl, true);
- texCoordFboAttr.enableBuffer(gl, true);
+ gca_FboVerticesAttr.enableBuffer(gl, true);
+ gca_FboTexCoordsAttr.enableBuffer(gl, true);
indicesFbo.bindBuffer(gl, true); // keeps VBO binding
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
indicesFbo.bindBuffer(gl, false);
- texCoordFboAttr.enableBuffer(gl, false);
- verticeFboAttr.enableBuffer(gl, false);
+ gca_FboTexCoordsAttr.enableBuffer(gl, false);
+ gca_FboVerticesAttr.enableBuffer(gl, false);
fbo.unuse(gl);
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
@@ -336,8 +369,6 @@ public class VBORegion2PMSAAES2 extends GLRegion {
private void renderRegion2FBO(final GL2ES2 gl, final RenderState rs, final int targetFboWidth, final int targetFboHeight,
final int vpWidth, final int vpHeight, final int[] sampleCount) {
- final ShaderState st = rs.getShaderState();
-
if( 0 >= targetFboWidth || 0 >= targetFboHeight ) {
throw new IllegalArgumentException("fboSize must be greater than 0: "+targetFboWidth+"x"+targetFboHeight);
}
@@ -373,29 +404,26 @@ public class VBORegion2PMSAAES2 extends GLRegion {
fboHeight = targetFboHeight;
}
fbo.bind(gl);
- setTexSize(gl, st, true, vpWidth, vpHeight, sampleCount[0]);
//render texture
gl.glViewport(0, 0, fboWidth, fboHeight);
- st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
-
- st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
+ fboDirty = false;
}
private void renderRegion(final GL2ES2 gl) {
- verticeTxtAttr.enableBuffer(gl, true);
- texCoordTxtAttr.enableBuffer(gl, true);
- indicesTxtBuffer.bindBuffer(gl, true); // keeps VBO binding
+ gca_VerticesAttr.enableBuffer(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, true);
+ indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxtBuffer.getElementCount() * indicesTxtBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
- indicesTxtBuffer.bindBuffer(gl, false);
- texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.enableBuffer(gl, false);
+ indicesBuffer.bindBuffer(gl, false);
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.enableBuffer(gl, false);
}
@Override
@@ -403,34 +431,29 @@ public class VBORegion2PMSAAES2 extends GLRegion {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
}
- final ShaderState st = renderer.getShaderState();
if(null != fbo) {
fbo.destroy(gl);
fbo = null;
}
- if(null != verticeTxtAttr) {
- st.ownAttribute(verticeTxtAttr, false);
- verticeTxtAttr.destroy(gl);
- verticeTxtAttr = null;
+ if(null != gca_VerticesAttr) {
+ gca_VerticesAttr.destroy(gl);
+ gca_VerticesAttr = null;
}
- if(null != texCoordTxtAttr) {
- st.ownAttribute(texCoordTxtAttr, false);
- texCoordTxtAttr.destroy(gl);
- texCoordTxtAttr = null;
+ if(null != gca_CurveParamsAttr) {
+ gca_CurveParamsAttr.destroy(gl);
+ gca_CurveParamsAttr = null;
}
- if(null != indicesTxtBuffer) {
- indicesTxtBuffer.destroy(gl);
- indicesTxtBuffer = null;
+ if(null != indicesBuffer) {
+ indicesBuffer.destroy(gl);
+ indicesBuffer = null;
}
- if(null != verticeFboAttr) {
- st.ownAttribute(verticeFboAttr, false);
- verticeFboAttr.destroy(gl);
- verticeFboAttr = null;
+ if(null != gca_FboVerticesAttr) {
+ gca_FboVerticesAttr.destroy(gl);
+ gca_FboVerticesAttr = null;
}
- if(null != texCoordFboAttr) {
- st.ownAttribute(texCoordFboAttr, false);
- texCoordFboAttr.destroy(gl);
- texCoordFboAttr = null;
+ if(null != gca_FboTexCoordsAttr) {
+ gca_FboTexCoordsAttr.destroy(gl);
+ gca_FboTexCoordsAttr = null;
}
if(null != indicesFbo) {
indicesFbo.destroy(gl);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 4a12ed8d9..afaae3679 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -32,7 +32,6 @@ import java.nio.FloatBuffer;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL;
import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
@@ -49,7 +48,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
-import com.jogamp.opengl.util.glsl.ShaderState;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
public class VBORegion2PVBAAES2 extends GLRegion {
private static final boolean DEBUG_FBO_1 = false;
@@ -85,38 +84,102 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
- private GLArrayDataServer verticeTxtAttr;
- private GLArrayDataServer texCoordTxtAttr;
- private GLArrayDataServer indicesTxtBuffer;
- private GLArrayDataServer verticeFboAttr;
- private GLArrayDataServer texCoordFboAttr;
+ // Pass-1:
+ private GLArrayDataServer gca_VerticesAttr;
+ private GLArrayDataServer gca_CurveParamsAttr;
+ private GLArrayDataServer gca_ColorsAttr;
+ private GLArrayDataServer indicesBuffer;
+ private ShaderProgram spPass1 = null;
+
+ // Pass-2:
+ private GLArrayDataServer gca_FboVerticesAttr;
+ private GLArrayDataServer gca_FboTexCoordsAttr;
private GLArrayDataServer indicesFbo;
+ private final GLUniformData gcu_FboTexUnit;
+ private final GLUniformData gcu_FboTexSize;
+ private final PMVMatrix fboPMVMatrix;
+ private final GLUniformData gcu_PMVMatrix02;
+ private boolean gcu_FboTexSize_dirty = true;
+ private boolean gcu_PMVMatrix02_dirty = true;
+ private ShaderProgram spPass2 = null;
private FBObject fbo;
private TextureAttachment texA;
- private final PMVMatrix fboPMVMatrix;
- GLUniformData mgl_fboPMVMatrix;
private int fboWidth = 0;
private int fboHeight = 0;
private boolean fboDirty = true;
- GLUniformData mgl_ActiveTexture;
- GLUniformData mgl_TextureSize;
final int[] maxTexSize = new int[] { -1 } ;
+ public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int renderModes, final boolean pass1, final int quality, final int sampleCount) {
+ final RenderState rs = renderer.getRenderState();
+ final boolean updateLocation0 = renderer.useShaderProgram(gl, renderModes, pass1, quality, sampleCount);
+ final ShaderProgram sp = renderer.getRenderState().getShaderProgram();
+ final boolean updateLocation;
+ if( pass1 ) {
+ updateLocation = !sp.equals(spPass1);
+ spPass1 = sp;
+ rs.update(gl, updateLocation, renderModes, true);
+ rs.updateUniformLoc(gl, updateLocation, gcu_PMVMatrix02);
+ rs.updateAttributeLoc(gl, updateLocation, gca_VerticesAttr);
+ rs.updateAttributeLoc(gl, updateLocation, gca_CurveParamsAttr);
+ if( null != gca_ColorsAttr ) {
+ rs.updateAttributeLoc(gl, updateLocation, gca_ColorsAttr);
+ }
+ System.err.println("XXX changedSP.p1 "+updateLocation+" / "+updateLocation0+", "+rs);
+ } else {
+ updateLocation = !sp.equals(spPass2);
+ spPass2 = sp;
+ rs.update(gl, updateLocation, renderModes, false);
+ rs.updateAttributeLoc(gl, updateLocation, gca_FboVerticesAttr);
+ rs.updateAttributeLoc(gl, updateLocation, gca_FboTexCoordsAttr);
+ rs.updateUniformDataLoc(gl, updateLocation, true, gcu_FboTexUnit);
+ rs.updateUniformLoc(gl, updateLocation, gcu_FboTexSize);
+ System.err.println("XXX changedSP.p2 "+updateLocation+" / "+updateLocation0+", "+rs);
+ }
+ }
+
public VBORegion2PVBAAES2(final int renderModes, final int textureUnit) {
super(renderModes);
final int initialElementCount = 256;
- fboPMVMatrix = new PMVMatrix();
- mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
- mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureUnit);
- indicesTxtBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ // Pass 1:
+ indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+
+ gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
+ if( hasColorChannel() ) {
+ gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
+ } else {
+ gca_ColorsAttr = null;
+ }
+
+ // Pass 2:
+ fboPMVMatrix = new PMVMatrix();
+ gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
+ gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, textureUnit);
+ gcu_FboTexSize = new GLUniformData(UniformNames.gcu_FboTexSize, 2, Buffers.newDirectFloatBuffer(2));
+
+ indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
+ indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
+ indicesFbo.seal(true);
+
+ gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ false, 4, GL.GL_STATIC_DRAW);
+ gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0);
+ gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1);
+ gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(1);
+ gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0);
+ gca_FboTexCoordsAttr.seal(true);
+
+ gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, 4, GL.GL_STATIC_DRAW);
}
@Override
@@ -125,88 +188,86 @@ public class VBORegion2PVBAAES2 extends GLRegion {
System.err.println("VBORegion2PES2 Clear: " + this);
// Thread.dumpStack();
}
- if( null != indicesTxtBuffer ) {
- indicesTxtBuffer.seal(gl, false);
- indicesTxtBuffer.rewind();
+ if( null != indicesBuffer ) {
+ indicesBuffer.seal(gl, false);
+ indicesBuffer.rewind();
}
- if( null != verticeTxtAttr ) {
- verticeTxtAttr.seal(gl, false);
- verticeTxtAttr.rewind();
+ if( null != gca_VerticesAttr ) {
+ gca_VerticesAttr.seal(gl, false);
+ gca_VerticesAttr.rewind();
}
- if( null != texCoordTxtAttr ) {
- texCoordTxtAttr.seal(gl, false);
- texCoordTxtAttr.rewind();
+ if( null != gca_CurveParamsAttr ) {
+ gca_CurveParamsAttr.seal(gl, false);
+ gca_CurveParamsAttr.rewind();
+ }
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.seal(gl, false);
+ gca_ColorsAttr.rewind();
}
fboDirty = true;
}
@Override
- protected final void pushVertex(float[] coords, float[] texParams) {
- verticeTxtAttr.putf(coords[0]);
- verticeTxtAttr.putf(coords[1]);
- verticeTxtAttr.putf(coords[2]);
-
- texCoordTxtAttr.putf(texParams[0]);
- texCoordTxtAttr.putf(texParams[1]);
- texCoordTxtAttr.putf(texParams[2]);
+ protected final void pushVertex(final float[] coords, final float[] texParams, float[] rgba) {
+ gca_VerticesAttr.putf(coords[0]);
+ gca_VerticesAttr.putf(coords[1]);
+ gca_VerticesAttr.putf(coords[2]);
+
+ gca_CurveParamsAttr.putf(texParams[0]);
+ gca_CurveParamsAttr.putf(texParams[1]);
+ gca_CurveParamsAttr.putf(texParams[2]);
+
+ if( null != gca_ColorsAttr ) {
+ if( null != rgba ) {
+ gca_ColorsAttr.putf(rgba[0]);
+ gca_ColorsAttr.putf(rgba[1]);
+ gca_ColorsAttr.putf(rgba[2]);
+ gca_ColorsAttr.putf(rgba[3]);
+ } else {
+ throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
+ }
+ }
}
@Override
protected final void pushIndex(int idx) {
- indicesTxtBuffer.puts((short)idx);
+ indicesBuffer.puts((short)idx);
}
@Override
protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) {
if(null == indicesFbo) {
- final ShaderState st = renderer.getShaderState();
-
- indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
- indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
- indicesFbo.seal(true);
-
- texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
- false, 4, GL.GL_STATIC_DRAW);
- st.ownAttribute(texCoordFboAttr, true);
- texCoordFboAttr.putf(0); texCoordFboAttr.putf(0);
- texCoordFboAttr.putf(0); texCoordFboAttr.putf(1);
- texCoordFboAttr.putf(1); texCoordFboAttr.putf(1);
- texCoordFboAttr.putf(1); texCoordFboAttr.putf(0);
- texCoordFboAttr.seal(true);
-
- verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, 4, GL.GL_STATIC_DRAW);
- st.ownAttribute(verticeFboAttr, true);
-
- st.ownAttribute(verticeTxtAttr, true);
- st.ownAttribute(texCoordTxtAttr, true);
-
if(Region.DEBUG_INSTANCE) {
System.err.println("VBORegion2PVBAAES2 Create: " + this);
}
}
// seal buffers
- indicesTxtBuffer.seal(gl, true);
- indicesTxtBuffer.enableBuffer(gl, false);
- texCoordTxtAttr.seal(gl, true);
- texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.seal(gl, true);
- verticeTxtAttr.enableBuffer(gl, false);
+ indicesBuffer.seal(gl, true);
+ indicesBuffer.enableBuffer(gl, false);
+ gca_CurveParamsAttr.seal(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.seal(gl, true);
+ gca_VerticesAttr.enableBuffer(gl, false);
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.seal(gl, true);
+ gca_ColorsAttr.enableBuffer(gl, false);
+ }
// update all bbox related data
- verticeFboAttr.seal(gl, false);
- verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMinX()); verticeFboAttr.putf(box.getMaxY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()); verticeFboAttr.putf(box.getMaxY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.putf(box.getMaxX()); verticeFboAttr.putf(box.getMinY()); verticeFboAttr.putf(box.getMinZ());
- verticeFboAttr.seal(gl, true);
- verticeFboAttr.enableBuffer(gl, false);
-
- fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- fboPMVMatrix.glLoadIdentity();
- fboPMVMatrix.glOrthof(box.getMinX(), box.getMaxX(), box.getMinY(), box.getMaxY(), -1, 1);
+ gca_FboVerticesAttr.seal(gl, false);
+ {
+ final FloatBuffer fb = (FloatBuffer)gca_FboVerticesAttr.getBuffer();
+ fb.put( 2, box.getMinZ());
+ fb.put( 5, box.getMinZ());
+ fb.put( 8, box.getMinZ());
+ fb.put(11, box.getMinZ());
+ }
+ // Pending .. (follow fboDirty)
+ // gca_FboVerticesAttr.seal(gl, true);
+ // gca_FboVerticesAttr.enableBuffer(gl, false);
+ // fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ // fboPMVMatrix.glLoadIdentity();
+ // fboPMVMatrix.glOrthof(box.getMinX(), box.getMaxX(), box.getMinY(), box.getMaxY(), -1, 1);
// push data 2 GPU ..
indicesFbo.seal(gl, true);
@@ -223,7 +284,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
@Override
protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) {
- if( 0 >= indicesTxtBuffer.getElementCount() ) {
+ if( 0 >= indicesBuffer.getElementCount() ) {
if(DEBUG_INSTANCE) {
System.err.printf("VBORegion2PVBAAES2.drawImpl: Empty%n");
}
@@ -387,56 +448,47 @@ public class VBORegion2PVBAAES2 extends GLRegion {
final float minY = box.getMinY()-diffObjBorderHeight;
final float maxX = box.getMaxX()+diffObjBorderWidth+diffObjWidth+diffObjResizeWidth;
final float maxY = box.getMaxY()+diffObjBorderHeight+diffObjHeight+diffObjResizeHeight;
- verticeFboAttr.seal(false);
+ gca_FboVerticesAttr.seal(false);
{
- final FloatBuffer fb = (FloatBuffer)verticeFboAttr.getBuffer();
+ final FloatBuffer fb = (FloatBuffer)gca_FboVerticesAttr.getBuffer();
fb.put(0, minX); fb.put( 1, minY);
fb.put(3, minX); fb.put( 4, maxY);
fb.put(6, maxX); fb.put( 7, maxY);
fb.put(9, maxX); fb.put(10, minY);
}
- verticeFboAttr.seal(true);
+ gca_FboVerticesAttr.seal(true);
fboPMVMatrix.glLoadIdentity();
fboPMVMatrix.glOrthof(minX, maxX, minY, maxY, -1, 1);
+ gcu_PMVMatrix02_dirty = true;
+ useShaderProgram(gl, renderer, getRenderModes(), true, getQuality(), sampleCount[0]);
renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, newFboWidth, newFboHeight, vpWidth, vpHeight, sampleCount[0]);
}
+ useShaderProgram(gl, renderer, getRenderModes(), false, getQuality(), sampleCount[0]);
renderFBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount[0]);
}
}
- private void setTexSize(final GL2ES2 gl, final ShaderState st, final boolean firstPass, final int width, final int height, final int sampleCount) {
- if(null == mgl_TextureSize) {
- mgl_TextureSize = new GLUniformData(UniformNames.gcu_TextureSize, 3, Buffers.newDirectFloatBuffer(3));
- }
- final FloatBuffer texSize = (FloatBuffer) mgl_TextureSize.getBuffer();
- texSize.put(0, width);
- texSize.put(1, height);
- if( firstPass ) {
- texSize.put(2, 0f);
- } else {
- texSize.put(2, sampleCount);
- }
- st.uniform(gl, mgl_TextureSize);
- }
private void renderFBO(final GL2ES2 gl, final RenderState rs, final int targetFboWidth, final int targetFboHeight,
final int vpWidth, final int vpHeight, final int sampleCount) {
- final ShaderState st = rs.getShaderState();
-
gl.glViewport(0, 0, vpWidth, vpHeight);
- st.uniform(gl, mgl_ActiveTexture);
- gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
- setTexSize(gl, st, false, fboWidth, fboHeight, sampleCount);
+
+ if( gcu_FboTexSize_dirty ) {
+ gl.glUniform(gcu_FboTexSize);
+ gcu_FboTexSize_dirty = false;
+ }
+
+ gl.glActiveTexture(GL.GL_TEXTURE0 + gcu_FboTexUnit.intValue());
fbo.use(gl, texA);
- verticeFboAttr.enableBuffer(gl, true);
- texCoordFboAttr.enableBuffer(gl, true);
+ gca_FboVerticesAttr.enableBuffer(gl, true);
+ gca_FboTexCoordsAttr.enableBuffer(gl, true);
indicesFbo.bindBuffer(gl, true); // keeps VBO binding
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
indicesFbo.bindBuffer(gl, false);
- texCoordFboAttr.enableBuffer(gl, false);
- verticeFboAttr.enableBuffer(gl, false);
+ gca_FboTexCoordsAttr.enableBuffer(gl, false);
+ gca_FboVerticesAttr.enableBuffer(gl, false);
fbo.unuse(gl);
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
@@ -445,8 +497,6 @@ public class VBORegion2PVBAAES2 extends GLRegion {
private void renderRegion2FBO(final GL2ES2 gl, final RenderState rs,
final int targetFboWidth, final int targetFboHeight, final int newFboWidth, final int newFboHeight,
final int vpWidth, final int vpHeight, final int sampleCount) {
- final ShaderState st = rs.getShaderState();
-
if( 0 >= targetFboWidth || 0 >= targetFboHeight ) {
throw new IllegalArgumentException("fboSize must be greater than 0: "+targetFboWidth+"x"+targetFboHeight);
}
@@ -454,6 +504,12 @@ public class VBORegion2PVBAAES2 extends GLRegion {
if(null == fbo) {
fboWidth = newFboWidth;
fboHeight = newFboHeight;
+ final FloatBuffer fboTexSize = (FloatBuffer) gcu_FboTexSize.getBuffer();
+ {
+ fboTexSize.put(0, fboWidth);
+ fboTexSize.put(1, fboHeight);
+ gcu_FboTexSize_dirty=true;
+ }
fbo = new FBObject();
fbo.reset(gl, fboWidth, fboHeight);
// Shall not use bilinear (GL_LINEAR), due to own VBAA. Result is smooth w/o it now!
@@ -472,33 +528,46 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
fboWidth = newFboWidth;
fboHeight = newFboHeight;
+ final FloatBuffer fboTexSize = (FloatBuffer) gcu_FboTexSize.getBuffer();
+ {
+ fboTexSize.put(0, fboWidth);
+ fboTexSize.put(1, fboHeight);
+ gcu_FboTexSize_dirty=true;
+ }
} else {
fbo.bind(gl);
}
- setTexSize(gl, st, true, vpWidth, vpHeight, sampleCount);
//render texture
gl.glViewport(0, 0, fboWidth, fboHeight);
- st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
+
+ if( gcu_PMVMatrix02_dirty ) {
+ gl.glUniform(gcu_PMVMatrix02);
+ gcu_PMVMatrix02_dirty = false;
+ }
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
fboDirty = false;
-
- st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
}
private void renderRegion(final GL2ES2 gl) {
- verticeTxtAttr.enableBuffer(gl, true);
- texCoordTxtAttr.enableBuffer(gl, true);
- indicesTxtBuffer.bindBuffer(gl, true); // keeps VBO binding
+ gca_VerticesAttr.enableBuffer(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, true);
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.enableBuffer(gl, true);
+ }
+ indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxtBuffer.getElementCount() * indicesTxtBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
- indicesTxtBuffer.bindBuffer(gl, false);
- texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.enableBuffer(gl, false);
+ indicesBuffer.bindBuffer(gl, false);
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.enableBuffer(gl, false);
+ }
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.enableBuffer(gl, false);
}
@Override
@@ -507,35 +576,35 @@ public class VBORegion2PVBAAES2 extends GLRegion {
System.err.println("VBORegion2PES2 Destroy: " + this);
// Thread.dumpStack();
}
- final ShaderState st = renderer.getShaderState();
if(null != fbo) {
fbo.destroy(gl);
fbo = null;
texA = null;
}
- if(null != verticeTxtAttr) {
- st.ownAttribute(verticeTxtAttr, false);
- verticeTxtAttr.destroy(gl);
- verticeTxtAttr = null;
+ if(null != gca_VerticesAttr) {
+ gca_VerticesAttr.destroy(gl);
+ gca_VerticesAttr = null;
+ }
+ if(null != gca_CurveParamsAttr) {
+ gca_CurveParamsAttr.destroy(gl);
+ gca_CurveParamsAttr = null;
}
- if(null != texCoordTxtAttr) {
- st.ownAttribute(texCoordTxtAttr, false);
- texCoordTxtAttr.destroy(gl);
- texCoordTxtAttr = null;
+ if(null != gca_ColorsAttr) {
+ gca_ColorsAttr.destroy(gl);
+ gca_ColorsAttr = null;
}
- if(null != indicesTxtBuffer) {
- indicesTxtBuffer.destroy(gl);
- indicesTxtBuffer = null;
+ if(null != indicesBuffer) {
+ indicesBuffer.destroy(gl);
+ indicesBuffer = null;
}
- if(null != verticeFboAttr) {
- st.ownAttribute(verticeFboAttr, false);
- verticeFboAttr.destroy(gl);
- verticeFboAttr = null;
+
+ if(null != gca_FboVerticesAttr) {
+ gca_FboVerticesAttr.destroy(gl);
+ gca_FboVerticesAttr = null;
}
- if(null != texCoordFboAttr) {
- st.ownAttribute(texCoordFboAttr, false);
- texCoordFboAttr.destroy(gl);
- texCoordFboAttr = null;
+ if(null != gca_FboTexCoordsAttr) {
+ gca_FboTexCoordsAttr.destroy(gl);
+ gca_FboTexCoordsAttr = null;
}
if(null != indicesFbo) {
indicesFbo.destroy(gl);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index cf85628ad..659f64847 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -34,25 +34,33 @@ import jogamp.graph.curve.opengl.shader.AttributeNames;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.util.GLArrayDataServer;
-import com.jogamp.opengl.util.glsl.ShaderState;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
public class VBORegionSPES2 extends GLRegion {
- private GLArrayDataServer verticeAttr = null;
- private GLArrayDataServer texCoordAttr = null;
+ private GLArrayDataServer gca_VerticesAttr = null;
+ private GLArrayDataServer gca_CurveParamsAttr = null;
+ private GLArrayDataServer gca_ColorsAttr;
private GLArrayDataServer indicesBuffer = null;
- private boolean buffersAttached = false;
public VBORegionSPES2(final int renderModes) {
super(renderModes);
final int initialElementCount = 256;
indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
- texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
+
+ if( hasColorChannel() ) {
+ gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
+ } else {
+ gca_ColorsAttr = null;
+ }
}
@Override
@@ -64,25 +72,40 @@ public class VBORegionSPES2 extends GLRegion {
indicesBuffer.seal(gl, false);
indicesBuffer.rewind();
}
- if( null != verticeAttr ) {
- verticeAttr.seal(gl, false);
- verticeAttr.rewind();
+ if( null != gca_VerticesAttr ) {
+ gca_VerticesAttr.seal(gl, false);
+ gca_VerticesAttr.rewind();
}
- if( null != texCoordAttr ) {
- texCoordAttr.seal(gl, false);
- texCoordAttr.rewind();
+ if( null != gca_CurveParamsAttr ) {
+ gca_CurveParamsAttr.seal(gl, false);
+ gca_CurveParamsAttr.rewind();
+ }
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.seal(gl, false);
+ gca_ColorsAttr.rewind();
}
}
@Override
- protected final void pushVertex(float[] coords, float[] texParams) {
- verticeAttr.putf(coords[0]);
- verticeAttr.putf(coords[1]);
- verticeAttr.putf(coords[2]);
-
- texCoordAttr.putf(texParams[0]);
- texCoordAttr.putf(texParams[1]);
- texCoordAttr.putf(texParams[2]);
+ protected final void pushVertex(float[] coords, float[] texParams, float[] rgba) {
+ gca_VerticesAttr.putf(coords[0]);
+ gca_VerticesAttr.putf(coords[1]);
+ gca_VerticesAttr.putf(coords[2]);
+
+ gca_CurveParamsAttr.putf(texParams[0]);
+ gca_CurveParamsAttr.putf(texParams[1]);
+ gca_CurveParamsAttr.putf(texParams[2]);
+
+ if( null != gca_ColorsAttr ) {
+ if( null != rgba ) {
+ gca_ColorsAttr.putf(rgba[0]);
+ gca_ColorsAttr.putf(rgba[1]);
+ gca_ColorsAttr.putf(rgba[2]);
+ gca_ColorsAttr.putf(rgba[3]);
+ } else {
+ throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
+ }
+ }
}
@Override
@@ -92,43 +115,67 @@ public class VBORegionSPES2 extends GLRegion {
@Override
protected void updateImpl(final GL2ES2 gl, final RegionRenderer renderer) {
- if( !buffersAttached ) {
- final ShaderState st = renderer.getShaderState();
- st.ownAttribute(verticeAttr, true);
- st.ownAttribute(texCoordAttr, true);
- buffersAttached = true;
- }
// seal buffers
indicesBuffer.seal(gl, true);
indicesBuffer.enableBuffer(gl, false);
- verticeAttr.seal(gl, true);
- verticeAttr.enableBuffer(gl, false);
- texCoordAttr.seal(gl, true);
- texCoordAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.seal(gl, true);
+ gca_VerticesAttr.enableBuffer(gl, false);
+ gca_CurveParamsAttr.seal(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ if( null != gca_ColorsAttr ) {
+ gca_ColorsAttr.seal(gl, true);
+ gca_ColorsAttr.enableBuffer(gl, false);
+ }
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 idx "+indicesBuffer);
- System.err.println("VBORegionSPES2 ver "+verticeAttr);
- System.err.println("VBORegionSPES2 tex "+texCoordAttr);
+ System.err.println("VBORegionSPES2 ver "+gca_VerticesAttr);
+ System.err.println("VBORegionSPES2 tex "+gca_CurveParamsAttr);
}
}
+ private ShaderProgram spPass1 = null;
+
+ public void useShaderProgram(final GL2ES2 gl, final RegionRenderer renderer, final int renderModes, final int quality) {
+ final RenderState rs = renderer.getRenderState();
+ final boolean updateLocation0 = renderer.useShaderProgram(gl, renderModes, true, quality, 0);
+ final ShaderProgram sp = renderer.getRenderState().getShaderProgram();
+ final boolean updateLocation = !sp.equals(spPass1);
+ spPass1 = sp;
+
+ // update attribute-location and uniform data and location
+ rs.update(gl, updateLocation, renderModes, true);
+ rs.updateAttributeLoc(gl, updateLocation, gca_VerticesAttr);
+ rs.updateAttributeLoc(gl, updateLocation, gca_CurveParamsAttr);
+ if( null != gca_ColorsAttr ) {
+ rs.updateAttributeLoc(gl, updateLocation, gca_ColorsAttr);
+ }
+ System.err.println("XXX changedSP "+updateLocation+", "+rs);
+ System.err.println("XXX gca_VerticesAttr "+gca_VerticesAttr);
+ System.err.println("XXX gca_CurveParamsAttr "+gca_CurveParamsAttr);
+ System.err.println("XXX gca_ColorsAttr "+gca_ColorsAttr);
+ }
+
+
@Override
protected void drawImpl(final GL2ES2 gl, final RegionRenderer renderer, final int[/*1*/] sampleCount) {
+ final int renderModes = getRenderModes();
+ useShaderProgram(gl, renderer, renderModes, getQuality());
+
if( 0 >= indicesBuffer.getElementCount() ) {
if(DEBUG_INSTANCE) {
System.err.printf("VBORegionSPES2.drawImpl: Empty%n");
}
return; // empty!
}
- verticeAttr.enableBuffer(gl, true);
- texCoordAttr.enableBuffer(gl, true);
+ gca_VerticesAttr.enableBuffer(gl, true);
+ gca_CurveParamsAttr.enableBuffer(gl, true);
indicesBuffer.bindBuffer(gl, true); // keeps VBO binding
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
indicesBuffer.bindBuffer(gl, false);
- texCoordAttr.enableBuffer(gl, false);
- verticeAttr.enableBuffer(gl, false);
+ gca_CurveParamsAttr.enableBuffer(gl, false);
+ gca_VerticesAttr.enableBuffer(gl, false);
}
@Override
@@ -136,16 +183,17 @@ public class VBORegionSPES2 extends GLRegion {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
}
- final ShaderState st = renderer.getShaderState();
- if(null != verticeAttr) {
- st.ownAttribute(verticeAttr, false);
- verticeAttr.destroy(gl);
- verticeAttr = null;
+ if(null != gca_VerticesAttr) {
+ gca_VerticesAttr.destroy(gl);
+ gca_VerticesAttr = null;
+ }
+ if(null != gca_CurveParamsAttr) {
+ gca_CurveParamsAttr.destroy(gl);
+ gca_CurveParamsAttr = null;
}
- if(null != texCoordAttr) {
- st.ownAttribute(texCoordAttr, false);
- texCoordAttr.destroy(gl);
- texCoordAttr = null;
+ if(null != gca_ColorsAttr) {
+ gca_ColorsAttr.destroy(gl);
+ gca_ColorsAttr = null;
}
if(null != indicesBuffer) {
indicesBuffer.destroy(gl);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
index b46661778..b2c73a2e4 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
@@ -28,18 +28,22 @@
package jogamp.graph.curve.opengl.shader;
public class AttributeNames {
- /** The vertices index in an OGL object
+ /**
+ * The vertices index in an OGL object
*/
- public static final int VERTEX_ATTR_IDX = 0; // FIXME: AMD needs this to be location 0 ? hu ?
public static final String VERTEX_ATTR_NAME = "gca_Vertices";
- /** The Texture Coord index in an OGL object
+ /**
+ * The Texture Coord index in an OGL object
*/
- public static final int TEXCOORD_ATTR_IDX = 1;
- public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords";
+ public static final String CURVEPARAMS_ATTR_NAME = "gca_CurveParams";
- /** The color index in an OGL object
+ /**
+ * The color index in an OGL object
*/
- public static final int COLOR_ATTR_IDX = 2;
public static final String COLOR_ATTR_NAME = "gca_Colors";
+
+ public static final String FBO_VERTEX_ATTR_NAME = "gca_FboVertices";
+ public static final String FBO_TEXCOORDS_ATTR_NAME = "gca_FboTexCoords";
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index ce23aadac..df5ba35f2 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -1,10 +1,11 @@
package jogamp.graph.curve.opengl.shader;
public class UniformNames {
- public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
+ public static final String gcu_PMVMatrix01 = "gcu_PMVMatrix01"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_ColorStatic = "gcu_ColorStatic";
- public static final String gcu_Alpha = "gcu_Alpha";
public static final String gcu_Weight = "gcu_Weight";
- public static final String gcu_TextureUnit = "gcu_TextureUnit";
- public static final String gcu_TextureSize = "gcu_TextureSize";
+
+ public static final String gcu_PMVMatrix02 = "gcu_PMVMatrix01"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
+ public static final String gcu_FboTexUnit = "gcu_FboTexUnit";
+ public static final String gcu_FboTexSize = "gcu_FboTexSize";
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
index c4d9db535..b8c68a924 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
@@ -12,13 +12,19 @@ attribute vec4 gca_Vertices;
* hole or holeLike: 0 > y
* !hole : 0 < y
*
- * 0 == gcv_TexCoord.x : vertex-0 of triangle
- * 0.5 == gcv_TexCoord.x : vertex-1 of triangle
- * 1 == gcv_TexCoord.x : vertex-2 of triangle
+ * 0 == gcv_CurveParams.x : vertex-0 of triangle
+ * 0.5 == gcv_CurveParams.x : vertex-1 of triangle
+ * 1 == gcv_CurveParams.x : vertex-2 of triangle
*/
-attribute vec3 gca_TexCoords;
+attribute vec3 gca_CurveParams;
+
+attribute vec4 gca_FboVertices;
+attribute vec2 gca_FboTexCoords;
+
+#ifdef USE_COLOR_CHANNEL
+ attribute vec4 gca_Colors;
+#endif
-//attribute vec4 gca_Colors;
//attribute vec3 gca_Normals;
#endif // attributes_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
index 20acfbac6..6e60fc044 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm-weight.fp
@@ -14,15 +14,10 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
void main (void)
{
- vec3 color;
- float alpha;
// #include curverenderer01-pass1-curve-lineAA.glsl
#include curverenderer01-pass1-curve-weight.glsl
- mgl_FragColor = vec4(color, gcu_Alpha * alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
index 03d2f9408..18f06fff0 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-1pass_norm.fp
@@ -14,15 +14,10 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
void main (void)
{
- vec3 color;
- float alpha;
// #include curverenderer01-pass1-curve-lineAA.glsl
#include curverenderer01-pass1-curve-simple.glsl
- mgl_FragColor = vec4(color, gcu_Alpha * alpha);
}
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 fba66c398..0a4f7b331 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
@@ -15,28 +15,21 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
void main (void)
{
- vec3 color;
- float alpha;
-
- if( 0.0 < gcu_TextureSize.z ) {
+ if( 0.0 < gcu_FboTexSize.z ) {
// Pass-2: Dump Texture
- vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st);
+ vec4 t = texture2D(gcu_FboTexUnit, gcv_FboTexCoord.st);
#if 0
if( 0.0 == t.a ) {
discard; // discard freezes NV tegra2 compiler
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
} else {
#include curverenderer01-pass1-curve-weight.glsl
}
- mgl_FragColor = vec4(color, alpha);
}
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 e573bb347..c5cbb99b0 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
@@ -15,36 +15,22 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
void main (void)
{
- vec3 color;
- float alpha;
-
- if( 0.0 < gcu_TextureSize.z ) {
+ if( 0.0 < gcu_FboTexSize.z ) {
// Pass-2: Dump Texture
- vec4 t = texture2D(gcu_TextureUnit, gcv_TexCoord.st);
+ vec4 t = texture2D(gcu_FboTexUnit, gcv_FboTexCoord.st);
#if 0
if( 0.0 == t.a ) {
discard; // discard freezes NV tegra2 compiler
}
#endif
- color = t.rgb;
- #ifdef PREALPHA
- // alpha = mix(0.0, gcu_Alpha, t.a); // t.a one of [ 0.0, 1.0 ]
- // ^^ for = 0.0 == t.a ? 0.0 : gcu_Alpha;
- // mix(x, y, a) := x * ( 1 - a ) + y * a
- alpha = gcu_Alpha;
- #else
- alpha = gcu_Alpha * t.a;
- #endif
+ mgl_FragColor = t;
} else {
#include curverenderer01-pass1-curve-simple.glsl
}
- mgl_FragColor = vec4(color, alpha);
}
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 cca67a219..e3bcd20ae 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
@@ -15,18 +15,11 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
#define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY))
void main (void)
{
- vec3 color;
- float alpha;
-
- // Note: gcu_Alpha is multiplied in pass2!
-
- if( 0.0 < gcu_TextureSize.z ) {
+ if( 0.0 < gcu_FboTexSize.z ) {
// Quality: allsamples > [flipquad,rgss, quincunx] > poles
#include curverenderer01-pass2-vbaa_allsamples_equal.glsl
@@ -48,5 +41,4 @@ void main (void)
#include curverenderer01-pass1-curve-weight.glsl
}
- mgl_FragColor = vec4(color, alpha);
}
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 e4dca15cb..52c719e46 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
@@ -15,23 +15,19 @@
#include uniforms.glsl
#include varyings.glsl
-const vec3 zero3 = vec3(0);
-
#define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY))
void main (void)
{
- vec3 color;
- float alpha;
-
- // Note: gcu_Alpha is multiplied in pass2!
-
- if( 0.0 < gcu_TextureSize.z ) {
+ if( 0.0 < gcu_FboTexSize.z ) {
// Quality: allsamples > [flipquad,rgss, quincunx] > poles
-#include curverenderer01-pass2-vbaa_allsamples_equal.glsl
-// #include curverenderer01-pass2-vbaa_flipquad3.glsl
+ if( 0.0 >= gcu_FboTexSize.w ) {
+#include curverenderer01-pass2-vbaa_flipquad3.glsl
+ } else {
+#include curverenderer01-pass2-vbaa_allsamples_equal.glsl
+ }
// #include curverenderer01-pass2-vbaa_flipquad2.glsl
// #include curverenderer01-pass2-vbaa_flipquad.glsl
// #include curverenderer01-pass2-vbaa_rgss.glsl
@@ -48,5 +44,4 @@ void main (void)
#include curverenderer01-pass1-curve-simple.glsl
}
- mgl_FragColor = vec4(color, alpha);
}
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
deleted file mode 100644
index 770ab3d71..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-lineAA.glsl
+++ /dev/null
@@ -1,20 +0,0 @@
-
- // if( gcv_TexCoord.x == 10.0 && gcv_TexCoord.y == 10.0 ) {
- if( gcv_TexCoord.z > 0.0 ) {
- // pass-1: AA Lines
- #if 1
- // 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
- color = vec3(0, 0, 1.0);
- alpha = 1.0;
- #endif
- } 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
deleted file mode 100644
index cfa1b9000..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- // color = vec3(0, 1.0, 0);
- color = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else {
- // pass-1: curves
- vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 );
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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;
- 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-simple.orig.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl
deleted file mode 100644
index f73f24f12..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-simple.orig.glsl
+++ /dev/null
@@ -1,32 +0,0 @@
-
- vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) );
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- color = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else if ( gcv_TexCoord.x > 0.0 && ( rtex.y > 0.0 || rtex.x == 1.0 ) ) {
- // pass-1: curves
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0 && gcv_TexCoord.y < 0.0) {
- // discard; // freezes NV tegra2 compiler
- color = zero3;
- alpha = 0.0;
- } else {
- rtex.y = max(rtex.y, 0.0); // always >= 0
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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);
- }
- } else {
- color = zero3;
- alpha = 0.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
deleted file mode 100644
index 21e44a23f..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve-weight.glsl
+++ /dev/null
@@ -1,25 +0,0 @@
-
- if( gcv_TexCoord.x == 0.0 && gcv_TexCoord.y == 0.0 ) {
- // pass-1: Lines
- color = gcu_ColorStatic.rgb;
- alpha = 1.0;
- } else {
- // pass-1: curves
- vec2 rtex = vec2( abs(gcv_TexCoord.x), abs(gcv_TexCoord.y) - 0.1 );
-
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- 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);
-
- float aph = 2.0 - 2.0*w;
-
- 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-pass1-curve_lineAA.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_lineAA.glsl
new file mode 100644
index 000000000..79b3dd6fd
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_lineAA.glsl
@@ -0,0 +1,19 @@
+
+ // if( gcv_CurveParam.x == 10.0 && gcv_CurveParam.y == 10.0 ) {
+ if( gcv_CurveParam.z > 0.0 ) {
+ // pass-1: AA Lines
+ #if 1
+ // float dist = sqrt( gcv_CurveParam.x*gcv_CurveParam.x + gcv_CurveParam.y*gcv_CurveParam.y ); // magnitude
+ float dist = sqrt( gcv_CurveParam.y*gcv_CurveParam.y ); // magnitude
+ // float a = 1.0 - smoothstep (gcv_CurveParam.y-gcv_CurveParam.z, gcv_CurveParam.y, dist);
+ float r = gcv_CurveParam.x/3.0;
+ float wa = gcv_CurveParam.x+r;
+ float waHalf = wa/2.0;
+ float a = 1.0 - smoothstep (waHalf-2.0*r, waHalf, dist);
+ // mgl_FragColor = vec4(gcu_ColorStatic.rgb, gcu_ColorStatic.a * a);
+ mgl_FragColor = vec4(0, 0, 1.0, gcu_ColorStatic.a * a);
+ #else
+ mgl_FragColor = vec4(0, 0, 1.0, 1.0);
+ #endif
+ } 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
new file mode 100644
index 000000000..373e8d575
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.glsl
@@ -0,0 +1,26 @@
+
+ if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
+ // pass-1: Lines
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = gcv_Color * gcu_ColorStatic;
+#else
+ mgl_FragColor = gcu_ColorStatic;
+#endif
+ } else {
+ // pass-1: curves
+ vec2 rtex = vec2( abs(gcv_CurveParam.x), abs(gcv_CurveParam.y) - 0.1 );
+
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ 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));
+
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_CurveParam.y), 0.0, 1.0);
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = vec4(gcv_Color.rgb * gcu_ColorStatic.rgb, gcv_Color.a * gcu_ColorStatic.a * a);
+#else
+ mgl_FragColor = vec4(gcu_ColorStatic.rgb, gcu_ColorStatic.a * a);
+#endif
+ }
+
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
new file mode 100644
index 000000000..92f0fc07b
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_simple.orig.glsl
@@ -0,0 +1,37 @@
+
+ vec2 rtex = vec2( abs(gcv_CurveParam.x), abs(gcv_CurveParam.y) );
+
+ if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
+ // pass-1: Lines
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = gcv_Color * gcu_ColorStatic;
+#else
+ mgl_FragColor = gcu_ColorStatic;
+#endif
+ } else if ( gcv_CurveParam.x > 0.0 && ( rtex.y > 0.0 || rtex.x == 1.0 ) ) {
+ // pass-1: curves
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0 && gcv_CurveParam.y < 0.0) {
+ // discard; // freezes NV tegra2 compiler
+ mgl_FragColor = vec4(0);
+ } else {
+ rtex.y = max(rtex.y, 0.0); // always >= 0
+
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ 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));
+
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_CurveParam.y), 0.0, 1.0);
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = vec4(gcv_Color.rgb * gcu_ColorStatic.rgb, gcv_Color.a * gcu_ColorStatic.a * a);
+#else
+ mgl_FragColor = vec4(gcu_ColorStatic.rgb, gcu_ColorStatic.a * a);
+#endif
+ }
+ } else {
+ mgl_FragColor = vec4(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
new file mode 100644
index 000000000..1620a9532
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1-curve_weight.glsl
@@ -0,0 +1,32 @@
+
+ if( gcv_CurveParam.x == 0.0 && gcv_CurveParam.y == 0.0 ) {
+ // pass-1: Lines
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = gcv_Color * gcu_ColorStatic;
+#else
+ mgl_FragColor = gcu_ColorStatic;
+#endif
+ } else {
+ // pass-1: curves
+ vec2 rtex = vec2( abs(gcv_CurveParam.x), abs(gcv_CurveParam.y) - 0.1 );
+
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ 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);
+
+ float aph = 2.0 - 2.0*w;
+
+ 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));
+
+ float a = clamp(0.5 - ( position/length(f) ) * sign(gcv_CurveParam.y), 0.0, 1.0);
+#ifdef USE_COLOR_CHANNEL
+ mgl_FragColor = vec4(gcv_Color.rgb * gcu_ColorStatic.rgb, gcv_Color.a * gcu_ColorStatic.a * a);
+#else
+ mgl_FragColor = vec4(gcu_ColorStatic.rgb, gcu_ColorStatic.a * a);
+#endif
+ }
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
new file mode 100644
index 000000000..46729cfd0
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass1.vp
@@ -0,0 +1,30 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#if __VERSION__ >= 130
+ #define attribute in
+ #define varying out
+#endif
+
+#include uniforms.glsl
+#include attributes.glsl
+#include varyings.glsl
+
+void main(void)
+{
+ // gl_Position = gcu_PMVMatrix02[0] * gcu_PMVMatrix02[1] * vec4(gca_Vertices, 1);
+ gl_Position = gcu_PMVMatrix02[0] * gcu_PMVMatrix02[1] * gca_Vertices;
+#if 1
+ gcv_CurveParam = gca_CurveParams;
+#else
+ if( gcv_CurveParams.x <= -10.0 ) {
+ // vec4 tc = gcu_PMVMatrix02[0] * gcu_PMVMatrix02[1] * vec4(gca_CurveParams.xy, gca_Vertices.z, 1);
+ // gcv_CurveParams = vec3(tc.xy, gca_CurveParams.z);
+ gcv_CurveParam = gca_CurveParams;
+ } else {
+ gcv_CurveParam = gca_CurveParams;
+ }
+#endif
+#ifdef USE_COLOR_CHANNEL
+ gcv_Color = gca_Colors;
+#endif
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl
new file mode 100644
index 000000000..da7feeaa7
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allequal.glsl
@@ -0,0 +1,96 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_FboTexCoord is in center of sample pixels.
+
+ // float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
+
+ // Not only the poles (NW, SW, ..) but the whole edge!
+ const float sample_weight = 1.0 / ( SAMPLE_COUNT * SAMPLE_COUNT );
+
+ // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
+ vec2 texCoord = gcv_FboTexCoord.st;
+
+ vec4 t;
+
+ // SampleCount 2 -> 4x
+ t = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
+ #if SAMPLE_COUNT > 2
+ // SampleCount 4 -> +12x = 16p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 1.5)))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 1.5)))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; //
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed)
+
+ #if SAMPLE_COUNT > 4
+ // SampleCount 6 -> +20x = 36p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed)
+ #if SAMPLE_COUNT > 6
+ // SampleCount 8 -> +28x = 64p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight;
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed)
+ #endif
+ #endif
+ #endif
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ mgl_FragColor = t;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl
new file mode 100644
index 000000000..436dd4ed4
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allprop01.glsl
@@ -0,0 +1,113 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_FboTexCoord is in center of sample pixels.
+
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
+
+ // Not only the poles (NW, SW, ..) but the whole edge!
+ float pixelCount = sampleCount * sampleCount;
+
+ // sampleCount [0, 1, 3, 5, 7] are undefined!
+ float layerCount = ( sampleCount / 2.0 );
+
+ // sum of all integer [layerCount .. 1] -> Gauss
+ float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
+
+ vec2 texCoord = gcv_FboTexCoord.st;
+
+ vec4 t;
+
+ // Layer-1: SampleCount 2 -> 4x
+ t = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+
+ t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1
+
+ if( sampleCount > 2.0 ) {
+ // Layer-2: SampleCount 4 -> +12x = 16p
+ vec4 tn = vec4(0);
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW -> SW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW -> SE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 1.5))); //
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 1.5))); //
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE -> NE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 0.5))); //
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -0.5))); //
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE -> NW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -1.5))); //
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -1.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2
+
+ if( sampleCount > 4.0 ) {
+ // Layer-3: SampleCount 6 -> +20x = 36p
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW -> SW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW -> SE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE -> NE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE -> NW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -2.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3
+
+ if( sampleCount > 6.0 ) {
+ // Layer-4: SampleCount 8 -> +28x = 64p
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW -> SW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW -> SE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE -> NE Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -0.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -1.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -2.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE -> NW Edge
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -3.5)));
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -3.5))); // NW - 1 (closed)
+
+ t += tn * (layerCount - 3) / ( denom * 28.0 ); // weight layer 4
+ }
+ }
+ }
+
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ mgl_FragColor = t;
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
deleted file mode 100644
index 1d2451755..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl
+++ /dev/null
@@ -1,97 +0,0 @@
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
-
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
-
- // Not only the poles (NW, SW, ..) but the whole edge!
- float sample_weight = 1.0 / ( sampleCount * sampleCount );
-
- // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025);
- vec2 texCoord = gcv_TexCoord.st;
-
- 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; // 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.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;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge
- 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; //
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; //
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; //
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge
- 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.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;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.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( 0.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.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(-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.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;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight;
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed)
- }
- }
- }
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
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
deleted file mode 100644
index 79c89a444..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl
+++ /dev/null
@@ -1,114 +0,0 @@
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
-
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
-
- // Not only the poles (NW, SW, ..) but the whole edge!
- float pixelCount = sampleCount * sampleCount;
-
- // sampleCount [0, 1, 3, 5, 7] are undefined!
- float layerCount = ( sampleCount / 2.0 );
-
- // sum of all integer [layerCount .. 1] -> Gauss
- float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
-
- vec2 texCoord = gcv_TexCoord.st;
-
- 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))); // 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.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
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW -> SE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5))); //
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5))); //
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE -> NE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5))); //
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5))); //
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE -> NW Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5))); //
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5))); // NW - 1 (closed)
-
- t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2
-
- 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)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW -> SE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE -> NE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE -> NW Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5))); // NW - 1 (closed)
-
- t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3
-
- 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)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW -> SE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE -> NE Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE -> NW Edge
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)));
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5))); // NW - 1 (closed)
-
- t += tn * (layerCount - 3) / ( denom * 28.0 ); // weight layer 4
- }
- }
- }
-
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
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 b5c1494f8..3e74fb9a6 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
@@ -1,9 +1,9 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left!
+ // Note: gcv_FboTexCoord is in center of sample pixels, origin is bottom left!
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
// Just poles (NW, SW, ..)
float edge1H = sampleCount / 2.0;
@@ -14,20 +14,20 @@
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)
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
vec4 t;
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, -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]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge1H, edgeTH, 0.0, 0.0)*0.25; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeTH, -edge1H, 0.0, 0.0)*0.25; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeTH, edge1H, 0.0, 0.0)*0.25; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, 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, -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]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge1H, -edgeTH, 0.0, 0.0)*0.25; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeTH, edge1H, 0.0, 0.0)*0.25; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeTH, -edge1H, 0.0, 0.0)*0.25; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edge1H, edgeTH, 0.0, 0.0)*0.25; // upper-right [p1]
}
@@ -37,6 +37,5 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
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 98812861d..9e31e6bb7 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
@@ -1,17 +1,17 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left!
+ // Note: gcv_FboTexCoord is in center of sample pixels, origin is bottom left!
//
// Same as flipquad - but w/ rgss coordinates
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
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)
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
float edge1Q = ( sampleCount / 2.0 ) - 1.0;
vec4 t;
@@ -20,15 +20,15 @@
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, 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]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edge1Q, -0.5, -0.5)*0.25; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edge1Q, 0.5, 0.5)*0.25; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, 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, 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]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge1Q, 0.0, -0.5, -0.5)*0.25; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edge1Q, -0.5, 0.5)*0.25; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edge1Q, 0.5, -0.5)*0.25; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edge1Q, 0.0, 0.5, 0.5)*0.25; // upper-right [p1]
}
#if 0
@@ -37,6 +37,5 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
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 edfbd9deb..7a2cb0358 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
@@ -1,97 +1,103 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left!
+ // Note: gcv_FboTexCoord is in center of sample pixels, origin is bottom left!
//
// Same as flipquad - but w/ rgss coordinates
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ // float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
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)
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
vec4 t;
// #define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY))
- if( 1.0 == sampleCount ) {
- t = texture2D(gcu_TextureUnit, texCoord);
+ #if SAMPLE_COUNT == 1
+
+ t = texture2D(gcu_FboTexUnit, texCoord);
+
+ #elif SAMPLE_COUNT < 4
- } else if( 4.0 > sampleCount ) {
// SampleCount 2 -> 2p
const float weight = 1.0 / 2.0;
- float edge = ( sampleCount / 2.0 ) - 1.0;
+ const float edge = ( SAMPLE_COUNT / 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
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge, edge, -0.5, 0.5)*weight; // center
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edge, -edge, 0.5, -0.5)*weight; // center
+
+ #elif SAMPLE_COUNT < 8
- } else if( 8.0 > sampleCount ) {
// SampleCount 4 -> 4p
const float weight = 1.0 / 4.0;
- float edgeS4_1Q = ( sampleCount / 2.0 ) - 1.0;
+ const float edgeS4_1Q = ( SAMPLE_COUNT / 2.0 ) - 1.0;
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]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, 0.5, 0.5)*weight; // upper-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 0.5, -0.5)*weight; // lower-right [p4]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -0.5, 0.5)*weight; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, -0.5, -0.5)*weight; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, 0.5, 0.5)*weight; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 0.5, -0.5)*weight; // lower-right [p4]
} else {
- t = GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, -0.5, -0.5)*weight; // lower-left [p4]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, -0.5, 0.5)*weight; // upper-left [p3]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, 0.5, -0.5)*weight; // lower-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 0.5, 0.5)*weight; // upper-right [p1]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -0.5, -0.5)*weight; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, -0.5, 0.5)*weight; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, 0.5, -0.5)*weight; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 0.5, 0.5)*weight; // upper-right [p1]
}
- } else {
+
+ #else
+
// SampleCount 8 -> 16p
const float weight = 1.0 / 16.0;
const float edgeS4_1Q = 1.0;
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]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, -2.0-0.5)*weight; // upper-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0-0.5, -2.0-0.5)*weight; // lower-right [p4]
-
- t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, 2.0-0.5)*weight; // lower-left [p4]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, 2.0+0.5)*weight; // upper-left [p3]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0+0.5, 2.0-0.5)*weight; // lower-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0+0.5, 2.0+0.5)*weight; // upper-right [p1]
-
- t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, -2.0-0.5)*weight; // lower-left [p4]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, -2.0+0.5)*weight; // upper-left [p3]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0+0.5, -2.0-0.5)*weight; // lower-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0+0.5, -2.0+0.5)*weight; // upper-right [p1]
-
- 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]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, 2.0-0.5)*weight; // upper-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0-0.5, 2.0-0.5)*weight; // lower-right [p4]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, -2.0+0.5)*weight; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0-0.5, -2.0-0.5)*weight; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, -2.0-0.5)*weight; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0-0.5, -2.0-0.5)*weight; // lower-right [p4]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, 2.0-0.5)*weight; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, 2.0+0.5)*weight; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0+0.5, 2.0-0.5)*weight; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0+0.5, 2.0+0.5)*weight; // upper-right [p1]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, -2.0-0.5)*weight; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, -2.0+0.5)*weight; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0+0.5, -2.0-0.5)*weight; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0+0.5, -2.0+0.5)*weight; // upper-right [p1]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, 2.0+0.5)*weight; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0-0.5, 2.0-0.5)*weight; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, 2.0-0.5)*weight; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0-0.5, 2.0-0.5)*weight; // lower-right [p4]
} else {
- t = GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, -2.0-0.5)*weight; // lower-left [p4]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, -2.0+0.5)*weight; // upper-left [p3]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0+0.5, -2.0-0.5)*weight; // lower-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0+0.5, -2.0+0.5)*weight; // upper-right [p1]
-
- 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]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, 2.0-0.5)*weight; // upper-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0-0.5, 2.0-0.5)*weight; // lower-right [p4]
-
- 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]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, -2.0-0.5)*weight; // upper-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0-0.5, -2.0-0.5)*weight; // lower-right [p4]
-
- t += GetSample(gcu_TextureUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, 2.0-0.5)*weight; // lower-left [p4]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, 2.0+0.5)*weight; // upper-left [p3]
- t += GetSample(gcu_TextureUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0+0.5, 2.0-0.5)*weight; // lower-right [p2]
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0+0.5, 2.0+0.5)*weight; // upper-right [p1]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, -2.0-0.5)*weight; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, -2.0+0.5)*weight; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0+0.5, -2.0-0.5)*weight; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0+0.5, -2.0+0.5)*weight; // upper-right [p1]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, -2.0-0.5, 2.0+0.5)*weight; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, -2.0-0.5, 2.0-0.5)*weight; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, -2.0-0.5, 2.0-0.5)*weight; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, -2.0-0.5, 2.0-0.5)*weight; // lower-right [p4]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, -2.0+0.5)*weight; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0-0.5, -2.0-0.5)*weight; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, -2.0-0.5)*weight; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0-0.5, -2.0-0.5)*weight; // lower-right [p4]
+
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeS4_1Q, 0.0, 2.0-0.5, 2.0-0.5)*weight; // lower-left [p4]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edgeS4_1Q, 2.0-0.5, 2.0+0.5)*weight; // upper-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edgeS4_1Q, 2.0+0.5, 2.0-0.5)*weight; // lower-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeS4_1Q, 0.0, 2.0+0.5, 2.0+0.5)*weight; // upper-right [p1]
}
- }
+
+ #endif
#if 0
if(t.w == 0.0){
@@ -99,6 +105,5 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
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 6a2040577..015dc1b24 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
@@ -1,24 +1,24 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
+ // Note: gcv_FboTexCoord is in center of sample pixels.
- if( gcu_TextureSize.z < 4.0 ) {
+ if( gcu_FboTexSize.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;
- float sampleCount = gcu_TextureSize.z;
+ float sampleCount = gcu_FboTexSize.z;
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
const float poff = 1.0;
vec2 psize = 1.0 / texCoord; // pixel size
- 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);
+ vec3 rgbNW = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-poff, -poff))).rgb;
+ vec3 rgbSW = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-poff, poff))).rgb;
+ vec3 rgbSE = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( poff, poff))).rgb;
+ vec3 rgbNE = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( poff, -poff))).rgb;
+ vec4 rgbM = texture2D(gcu_FboTexUnit, texCoord);
const vec3 luma = vec3(0.299, 0.587, 0.114);
float lumaNW = dot(rgbNW, luma);
@@ -37,17 +37,17 @@
max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),dir * rcpDirMin) ) * psize;
- 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 );
+ vec3 rgbA = 0.5 * ( texture2D(gcu_FboTexUnit, texCoord + dir * (1.0/3.0 - 0.5)).rgb +
+ texture2D(gcu_FboTexUnit, texCoord + dir * (2.0/3.0 - 0.5)).rgb );
+ vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(gcu_FboTexUnit, texCoord + (dir * - 0.5)).rgb +
+ texture2D(gcu_FboTexUnit, texCoord + (dir * 0.5)).rgb );
float lumaB = dot(rgbB, luma);
if((lumaB < lumaMin) || (lumaB > lumaMax)) {
- color = rgbA;
+ mgl_FragColor.rgb = rgbA;
} else {
- color = rgbB;
+ mgl_FragColor.rgb = rgbB;
}
- alpha = gcu_Alpha * rgbM.a; // mix(0.0, gcu_Alpha, rgbM.a); // t.a one of [ 0.0, 1.0 ]
+ mgl_FragColor.a = gcu_Alpha * rgbM.a; // mix(0.0, gcu_Alpha, rgbM.a); // t.a one of [ 0.0, 1.0 ]
} else {
#include curverenderer01-pass2-vbaa_poles_equalweight.glsl
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 08475317e..d634c1f9b 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.
+ // Note: gcv_FboTexCoord is in center of sample pixels.
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
- float sampleCount = gcu_TextureSize.z;
- vec2 tsize = gcu_TextureSize.xy; // tex size
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 tsize = gcu_FboTexSize.xy; // tex size
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
// mix(x,y,a): x*(1-a) + y*a
//
@@ -31,10 +31,10 @@
vec4 t, p1, p2, p3, p4;
// Layer-1: SampleCount 2 -> 4x
- p1 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
- p2 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
- p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
- p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+ p1 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ p2 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ p3 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ p4 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
p1 = mix( p1, p4, uv_ratio.x);
p2 = mix( p2, p3, uv_ratio.x);
@@ -44,10 +44,10 @@
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
- p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
- p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
+ p1 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW
+ p2 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW
+ p3 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
+ p4 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
p1 = mix( p1, p4, uv_ratio.x);
p2 = mix( p2, p3, uv_ratio.x);
@@ -56,10 +56,10 @@
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
- p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
- p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
+ p1 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW
+ p2 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW
+ p3 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
+ p4 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
p1 = mix( p1, p4, uv_ratio.x);
p2 = mix( p2, p3, uv_ratio.x);
@@ -68,10 +68,10 @@
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
- p3 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
- p4 = texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
+ p1 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW
+ p2 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW
+ p3 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
+ p4 = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
p1 = mix( p1, p4, uv_ratio.x);
p2 = mix( p2, p3, uv_ratio.x);
@@ -88,5 +88,4 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
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
deleted file mode 100644
index a03294034..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_equalweight.glsl
+++ /dev/null
@@ -1,50 +0,0 @@
-
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
-
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
-
- // Just poles (NW, SW, ..)
- float sample_weight = 1 / ( 2 * sampleCount );
-
- vec2 texCoord = gcv_TexCoord.st;
-
- 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; // 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.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.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.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
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE
- t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE
- }
- }
- }
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
-
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
deleted file mode 100644
index d63dda7cc..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_poles_propweight1.glsl
+++ /dev/null
@@ -1,66 +0,0 @@
- // Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels.
-
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
-
- // Just poles (NW, SW, ..)
- float pixelCount = 2 * sampleCount;
-
- // sampleCount [0, 1, 3, 5, 7] are undefined!
- float layerCount = ( sampleCount / 2.0 );
-
- // sum of all integer [layerCount .. 1] -> Gauss
- float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
-
- vec2 texCoord = gcv_TexCoord.st;
-
- 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))); // 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.0 ) {
- // Layer-2: SampleCount 4 -> +4x = 8p
- vec4 tn = vec4(0);
- tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
-
- t += tn * (layerCount - 1) / ( denom * 4.0 ); // weight layer 2
-
- 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
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
-
- t += tn * (layerCount - 2) / ( denom * 4.0 ); // weight layer 3
-
- 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
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
- tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
-
- t += tn * (layerCount - 3) / ( denom * 4.0 ); // weight layer 4
- }
- }
- }
-
- #if 0
- if(t.w == 0.0){
- discard; // discard freezes NV tegra2 compiler
- }
- #endif
-
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl
new file mode 100644
index 000000000..0e8b6f161
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesequal.glsl
@@ -0,0 +1,49 @@
+
+ // Pass-2: AA on Texture
+ // Note: gcv_FboTexCoord is in center of sample pixels.
+
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
+
+ // Just poles (NW, SW, ..)
+ float sample_weight = 1 / ( 2 * sampleCount );
+
+ vec2 texCoord = gcv_FboTexCoord.st;
+
+ vec4 t;
+
+ // SampleCount 2 -> 4x
+ t = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE
+ if( sampleCount > 2.0 ) {
+ // SampleCount 4 -> +4 = 8p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE
+
+ if( sampleCount > 4.0 ) {
+ // SampleCount 6 -> +4 = 12p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE
+ if( sampleCount > 6.0 ) {
+ // SampleCount 8 -> +4 = 16p
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE
+ }
+ }
+ }
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ mgl_FragColor = t;
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl
new file mode 100644
index 000000000..6c263b9bd
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_polesprop01.glsl
@@ -0,0 +1,65 @@
+ // Pass-2: AA on Texture
+ // Note: gcv_FboTexCoord is in center of sample pixels.
+
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
+
+ // Just poles (NW, SW, ..)
+ float pixelCount = 2 * sampleCount;
+
+ // sampleCount [0, 1, 3, 5, 7] are undefined!
+ float layerCount = ( sampleCount / 2.0 );
+
+ // sum of all integer [layerCount .. 1] -> Gauss
+ float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 );
+
+ vec2 texCoord = gcv_FboTexCoord.st;
+
+ vec4 t;
+
+ // Layer-1: SampleCount 2 -> 4x
+ t = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE
+ t += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE
+
+ t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1
+
+ if( sampleCount > 2.0 ) {
+ // Layer-2: SampleCount 4 -> +4x = 8p
+ vec4 tn = vec4(0);
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE
+
+ t += tn * (layerCount - 1) / ( denom * 4.0 ); // weight layer 2
+
+ if( sampleCount > 4.0 ) {
+ // Layer-3: SampleCount 6 -> +4 = 12p
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE
+
+ t += tn * (layerCount - 2) / ( denom * 4.0 ); // weight layer 3
+
+ if( sampleCount > 6.0 ) {
+ // Layer-4: SampleCount 8 -> +4 = 16p
+ tn = texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE
+ tn += texture2D(gcu_FboTexUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE
+
+ t += tn * (layerCount - 3) / ( denom * 4.0 ); // weight layer 4
+ }
+ }
+ }
+
+ #if 0
+ if(t.w == 0.0){
+ discard; // discard freezes NV tegra2 compiler
+ }
+ #endif
+
+ mgl_FragColor = t;
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 545f1cc82..07a9adf46 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
@@ -1,22 +1,22 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left!
+ // Note: gcv_FboTexCoord is in center of sample pixels, origin is bottom left!
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
// Just poles (NW, SW, ..)
float edgeH = sampleCount / 2.0;
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
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, -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
- t += GetSample(gcu_TextureUnit, texCoord, psize, edgeH, edgeH, 0.0, 0.0)*0.125; // w5
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, 0.0, 0.0, 0.0)*0.5; // w1 - center
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeH, -edgeH, 0.0, 0.0)*0.125; // w2 - sharing
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, -edgeH, edgeH, 0.0, 0.0)*0.125; // w3 - edges
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeH, -edgeH, 0.0, 0.0)*0.125; // w4 - w/ all pixels
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edgeH, edgeH, 0.0, 0.0)*0.125; // w5
#if 0
if(t.w == 0.0){
@@ -24,6 +24,5 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
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 804ab6013..27a5684a6 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
@@ -1,19 +1,19 @@
// Pass-2: AA on Texture
- // Note: gcv_TexCoord is in center of sample pixels, origin is bottom left!
+ // Note: gcv_FboTexCoord is in center of sample pixels, origin is bottom left!
- float sampleCount = gcu_TextureSize.z;
- vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size
+ float sampleCount = gcu_FboTexSize.z;
+ vec2 psize = 1.0 / gcu_FboTexSize.xy; // pixel size
- vec2 texCoord = gcv_TexCoord.st;
+ vec2 texCoord = gcv_FboTexCoord.st;
float edge1Q = ( sampleCount / 2.0 ) - 1.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, 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]
+ t = GetSample(gcu_FboTexUnit, texCoord, psize, -edge1Q, 0.0, -0.5, 0.5)*0.25; // upper-left [p1]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, -edge1Q, -0.5, -0.5)*0.25; // lower-left [p3]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, 0.0, edge1Q, 0.5, 0.5)*0.25; // upper-right [p2]
+ t += GetSample(gcu_FboTexUnit, texCoord, psize, edge1Q, 0.0, 0.5, -0.5)*0.25; // lower-right [p4]
#if 0
if(t.w == 0.0){
@@ -21,6 +21,5 @@
}
#endif
- color = t.rgb;
- alpha = gcu_Alpha * t.a;
+ mgl_FragColor = t;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2.vp
new file mode 100644
index 000000000..64857c9ce
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2.vp
@@ -0,0 +1,17 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#if __VERSION__ >= 130
+ #define attribute in
+ #define varying out
+#endif
+
+#include uniforms.glsl
+#include attributes.glsl
+#include varyings.glsl
+
+void main(void)
+{
+ // gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * vec4(gca_FboVertices, 1);
+ gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * gca_FboVertices;
+ gcv_FboTexCoord = gca_FboTexCoords;
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-segment-head.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-segment-head.fp
new file mode 100644
index 000000000..74a1dea4e
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-segment-head.fp
@@ -0,0 +1,22 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+//
+// 2-pass shader w/o weight
+//
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+#include uniforms.glsl
+#include varyings.glsl
+
+#define GetSample(texUnit, texCoord, psize, cx, cy, offX, offY) texture2D(texUnit, texCoord + psize * vec2(cx+offX, cy+offY))
+
+void main (void)
+{
+
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
new file mode 100644
index 000000000..7598c23f8
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-single.vp
@@ -0,0 +1,30 @@
+//Copyright 2010 JogAmp Community. All rights reserved.
+
+#if __VERSION__ >= 130
+ #define attribute in
+ #define varying out
+#endif
+
+#include uniforms.glsl
+#include attributes.glsl
+#include varyings.glsl
+
+void main(void)
+{
+ // gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * vec4(gca_Vertices, 1);
+ gl_Position = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * gca_Vertices;
+#if 1
+ gcv_CurveParam = gca_CurveParams;
+#else
+ if( gcv_CurveParams.x <= -10.0 ) {
+ // vec4 tc = gcu_PMVMatrix01[0] * gcu_PMVMatrix01[1] * vec4(gca_CurveParams.xy, gca_Vertices.z, 1);
+ // gcv_CurveParams = vec3(tc.xy, gca_CurveParams.z);
+ gcv_CurveParam = gca_CurveParams;
+ } else {
+ gcv_CurveParam = gca_CurveParams;
+ }
+#endif
+#ifdef USE_COLOR_CHANNEL
+ gcv_Color = gca_Colors;
+#endif
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
deleted file mode 100644
index 5ab82ad40..000000000
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
+++ /dev/null
@@ -1,23 +0,0 @@
-//Copyright 2010 JogAmp Community. All rights reserved.
-
-#if __VERSION__ >= 130
- #define attribute in
- #define varying out
-#endif
-
-#include uniforms.glsl
-#include attributes.glsl
-#include varyings.glsl
-
-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 ) {
- // 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 {
- gcv_TexCoord = gca_TexCoords;
- }
-}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
index 92e78d5de..848c26819 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
@@ -2,14 +2,17 @@
#ifndef uniforms_glsl
#define uniforms_glsl
-uniform mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi
-uniform vec3 gcu_ColorStatic;
-uniform float gcu_Alpha;
+uniform mat4 gcu_PMVMatrix01[3]; // P, Mv, and Mvi
+uniform vec4 gcu_ColorStatic;
uniform float gcu_Weight;
-uniform sampler2D gcu_TextureUnit;
-/** 3rd component: 0: pass-1, >0: pass-2, sampleCount */
-uniform vec3 gcu_TextureSize;
+uniform mat4 gcu_PMVMatrix02[3]; // P, Mv, and Mvi
+uniform sampler2D gcu_FboTexUnit;
+
+/**
+ * .x .y : texture-, fbo- or screen-size
+ */
+uniform vec2 gcu_FboTexSize;
// const int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits
// const int MAX_LIGHTS = 8;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
index 17f118bc8..2054c9c21 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
@@ -2,8 +2,13 @@
#ifndef varyings_glsl
#define varyings_glsl
-//varying vec4 gcv_FrontColor;
-varying vec3 gcv_TexCoord;
+varying vec3 gcv_CurveParam;
+
+varying vec2 gcv_FboTexCoord;
+
+#ifdef USE_COLOR_CHANNEL
+ varying vec4 gcv_Color;
+#endif
#endif // varyings_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
index ad01c24fa..d2cfa42a1 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -54,7 +54,8 @@ public class CDTriangulator2D implements Triangulator {
private final ArrayList<Loop> loops = new ArrayList<Loop>();
- private int maxTriID = 0;
+ private int addedVerticeCount;
+ private int maxTriID;
/** Constructor for a new Delaunay triangulator
@@ -66,10 +67,17 @@ public class CDTriangulator2D implements Triangulator {
@Override
public final void reset() {
maxTriID = 0;
+ addedVerticeCount = 0;
loops.clear();
}
@Override
+ public final int getAddedVerticeCount() {
+ return addedVerticeCount;
+ }
+
+
+ @Override
public final void addCurve(final List<Triangle> sink, final Outline polyline, final float sharpness) {
Loop loop = null;
@@ -164,6 +172,7 @@ public class CDTriangulator2D implements Triangulator {
final Vertex v0 = gv0.getPoint().clone();
final Vertex v2 = gv2.getPoint().clone();
final Vertex v1 = gv1.getPoint().clone();
+ addedVerticeCount += 3;
final boolean[] boundaryVertices = { true, true, true };
gv0.setBoundaryContained(true);