summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java143
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java169
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java152
3 files changed, 2 insertions, 462 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index c6c7f567c..a6401fbd7 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -27,10 +27,7 @@
*/
package jogamp.graph.curve.opengl;
-import java.io.PrintStream;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
@@ -48,8 +45,6 @@ import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.Attachment;
import com.jogamp.opengl.math.Matrix4f;
import com.jogamp.opengl.math.Recti;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.SyncMatrices4f16;
@@ -65,12 +60,6 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
private final RenderState.ProgramLocal rsLocal;
// Pass-1:
- private int curVerticesCap = 0;
- private int curIndicesCap = 0;
- private GLArrayDataServer gca_VerticesAttr;
- private GLArrayDataServer gca_CurveParamsAttr;
- private GLArrayDataServer gca_ColorsAttr;
- private GLArrayDataServer indicesBuffer;
private final GLUniformData gcu_ColorTexUnit;
private final float[] colorTexBBox; // x0, y0, x1, y1
private final GLUniformData gcu_ColorTexBBox;
@@ -137,144 +126,12 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
false, 4, GL.GL_STATIC_DRAW);
}
- private void initBuffer(final int verticeCount, final int indexCount) {
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), indexCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesBuffer.setGrowthFactor(growthFactor);
- curIndicesCap = indicesBuffer.getElemCapacity();
-
- gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_VerticesAttr.setGrowthFactor(growthFactor);
- gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_CurveParamsAttr.setGrowthFactor(growthFactor);
- if( hasColorChannel() ) {
- gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_ColorsAttr.setGrowthFactor(growthFactor);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
-
- @Override
- public void growBuffer(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesBuffer.elemPosition() + indicesCount ) {
- indicesBuffer.growIfNeeded(indicesCount * indicesBuffer.getCompsPerElem());
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < gca_VerticesAttr.elemPosition() + verticesCount ) {
- gca_VerticesAttr.growIfNeeded(verticesCount * gca_VerticesAttr.getCompsPerElem());
- gca_CurveParamsAttr.growIfNeeded(verticesCount * gca_CurveParamsAttr.getCompsPerElem());
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.growIfNeeded(verticesCount * gca_ColorsAttr.getCompsPerElem());
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
- @Override
- public void setBufferCapacity(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesCount ) {
- indicesBuffer.reserve(indicesCount);
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < verticesCount ) {
- gca_VerticesAttr.reserve(verticesCount);
- gca_CurveParamsAttr.reserve(verticesCount);
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.reserve(verticesCount);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
@Override
protected final void clearImpl(final GL2ES2 gl) {
- if( null != indicesBuffer ) {
- indicesBuffer.clear(gl);
- }
- if( null != gca_VerticesAttr ) {
- gca_VerticesAttr.clear(gl);
- }
- if( null != gca_CurveParamsAttr ) {
- gca_CurveParamsAttr.clear(gl);
- }
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.clear(gl);
- }
fboDirty = true;
}
@Override
- public void printBufferStats(final PrintStream out) {
- final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegion2PMSAAES2: idx32 "+usesI32Idx());
- printAndCount(out, " indices ", indicesBuffer, size, capacity);
- out.println();
- printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
- out.println();
- printAndCount(out, " params ", gca_CurveParamsAttr, size, capacity);
- out.println();
- printAndCount(out, " color ", gca_ColorsAttr, size, capacity);
- final float filled = (float)size[0]/(float)capacity[0];
- out.println();
- out.printf(" total [bytes %,d / %,d], filled %.1f%%, left %.1f%%]%n",
- size[0], capacity[0], filled*100f, (1f-filled)*100f);
- }
-
- @Override
- protected final void pushVertex(final Vec3f coords, final Vec3f texParams, final Vec4f rgba) {
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushVertices(final Vec3f coords1, final Vec3f coords2, final Vec3f coords3,
- final Vec3f texParams1, final Vec3f texParams2, final Vec3f texParams3, final Vec4f rgba) {
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords1);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords3);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- final float r=rgba.x(), g=rgba.y(), b=rgba.z(), a=rgba.w();
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushIndex(final int idx) {
- if( usesI32Idx() ) {
- indicesBuffer.puti(idx);
- } else {
- indicesBuffer.puts((short)idx);
- }
- }
-
- @Override
- protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
- if( usesI32Idx() ) {
- put3i((IntBuffer)indicesBuffer.getBuffer(), idx1, idx2, idx3);
- } else {
- put3s((ShortBuffer)indicesBuffer.getBuffer(), (short)idx1, (short)idx2, (short)idx3);
- }
- }
-
- @Override
protected void updateImpl(final GL2ES2 gl, final int curRenderModes) {
final boolean hasColorChannel = Region.hasColorChannel( curRenderModes );
final boolean hasColorTexture = Region.hasColorTexture( curRenderModes );
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 1b580437f..49c91ce4b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -27,10 +27,7 @@
*/
package jogamp.graph.curve.opengl;
-import java.io.PrintStream;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
@@ -51,8 +48,6 @@ import com.jogamp.opengl.FBObject.Attachment;
import com.jogamp.opengl.FBObject.TextureAttachment;
import com.jogamp.opengl.math.Matrix4f;
import com.jogamp.opengl.math.Recti;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.SyncMatrices4f16;
@@ -98,12 +93,6 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
private final RenderState.ProgramLocal rsLocal;
// Pass-1:
- private int curVerticesCap = 0;
- private int curIndicesCap = 0;
- private GLArrayDataServer gca_VerticesAttr;
- private GLArrayDataServer gca_CurveParamsAttr;
- private GLArrayDataServer gca_ColorsAttr;
- private GLArrayDataServer indicesBuffer;
private final GLUniformData gcu_ColorTexUnit;
private final float[] colorTexBBox; // x0, y0, x1, y1
private final GLUniformData gcu_ColorTexBBox;
@@ -230,170 +219,12 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
false, 4, GL.GL_STATIC_DRAW);
}
- private void initBuffer(final int verticeCount, final int indexCount) {
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), indexCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesBuffer.setGrowthFactor(growthFactor);
- curIndicesCap = indicesBuffer.getElemCapacity();
-
- gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_VerticesAttr.setGrowthFactor(growthFactor);
- gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_CurveParamsAttr.setGrowthFactor(growthFactor);
- if( hasColorChannel() ) {
- gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_ColorsAttr.setGrowthFactor(growthFactor);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
-
- @Override
- public void growBuffer(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesBuffer.elemPosition() + indicesCount ) {
- // System.err.printf("XXX Buffer grow - Indices: %d < ( %d = %d + %d ); Status: %s%n",
- // curIndicesCap, indicesBuffer.elemPosition() + indicesCount, indicesBuffer.elemPosition(), indicesCount, indicesBuffer.elemStatsToString());
- indicesBuffer.growIfNeeded(indicesCount * indicesBuffer.getCompsPerElem());
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < gca_VerticesAttr.elemPosition() + verticesCount ) {
- // System.err.printf("XXX Buffer grow - Verices: %d < ( %d = %d + %d ); Status: %s%n",
- // curVerticesCap, gca_VerticesAttr.elemPosition() + verticesCount, gca_VerticesAttr.elemPosition(), verticesCount, gca_VerticesAttr.elemStatsToString());
- gca_VerticesAttr.growIfNeeded(verticesCount * gca_VerticesAttr.getCompsPerElem());
- gca_CurveParamsAttr.growIfNeeded(verticesCount * gca_CurveParamsAttr.getCompsPerElem());
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.growIfNeeded(verticesCount * gca_ColorsAttr.getCompsPerElem());
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
- @Override
- public void setBufferCapacity(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesCount ) {
- indicesBuffer.reserve(indicesCount);
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < verticesCount ) {
- gca_VerticesAttr.reserve(verticesCount);
- gca_CurveParamsAttr.reserve(verticesCount);
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.reserve(verticesCount);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
@Override
protected final void clearImpl(final GL2ES2 gl) {
- if(DEBUG_INSTANCE) {
- System.err.println("VBORegion2PES2 Clear: " + this);
- // Thread.dumpStack();
- }
- if( null != indicesBuffer ) {
- indicesBuffer.clear(gl);
- }
- if( null != gca_VerticesAttr ) {
- gca_VerticesAttr.clear(gl);
- }
- if( null != gca_CurveParamsAttr ) {
- gca_CurveParamsAttr.clear(gl);
- }
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.clear(gl);;
- }
fboDirty = true;
}
@Override
- public void printBufferStats(final PrintStream out) {
- final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegion2PVBAAES2: idx32 "+usesI32Idx());
- printAndCount(out, " indices ", indicesBuffer, size, capacity);
- out.println();
- printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
- out.println();
- printAndCount(out, " params ", gca_CurveParamsAttr, size, capacity);
- out.println();
- printAndCount(out, " color ", gca_ColorsAttr, size, capacity);
- final float filled = (float)size[0]/(float)capacity[0];
- out.println();
- out.printf(" total [bytes %,d / %,d], filled %.1f%%, left %.1f%%]%n",
- size[0], capacity[0], filled*100f, (1f-filled)*100f);
- }
-
- @Override
- protected final void pushVertex(final Vec3f coords, final Vec3f texParams, final Vec4f rgba) {
- // NIO array[3] is much slows than group/single
- // gca_VerticesAttr.putf(coords, 0, 3);
- // gca_CurveParamsAttr.putf(texParams, 0, 3);
- // gca_VerticesAttr.put3f(coords[0], coords[1], coords[2]);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords);
- // gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- // gca_ColorsAttr.putf(rgba, 0, 4);
- // gca_ColorsAttr.put4f(rgba[0], rgba[1], rgba[2], rgba[3]);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushVertices(final Vec3f coords1, final Vec3f coords2, final Vec3f coords3,
- final Vec3f texParams1, final Vec3f texParams2, final Vec3f texParams3, final Vec4f rgba) {
- // gca_VerticesAttr.put3f(coords1[0], coords1[1], coords1[2]);
- // gca_VerticesAttr.put3f(coords2[0], coords2[1], coords2[2]);
- // gca_VerticesAttr.put3f(coords3[0], coords3[1], coords3[2]);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords1);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords3);
- // gca_CurveParamsAttr.put3f(texParams1[0], texParams1[1], texParams1[2]);
- // gca_CurveParamsAttr.put3f(texParams2[0], texParams2[1], texParams2[2]);
- // gca_CurveParamsAttr.put3f(texParams3[0], texParams3[1], texParams3[2]);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- final float r=rgba.x(), g=rgba.y(), b=rgba.z(), a=rgba.w();
- // gca_ColorsAttr.put4f(r, g, b, a);
- // gca_ColorsAttr.put4f(r, g, b, a);
- // gca_ColorsAttr.put4f(r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushIndex(final int idx) {
- if( usesI32Idx() ) {
- indicesBuffer.puti(idx);
- } else {
- indicesBuffer.puts((short)idx);
- }
- }
-
- @Override
- protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
- if( usesI32Idx() ) {
- // indicesBuffer.put3i(idx1, idx2, idx3);
- put3i((IntBuffer)indicesBuffer.getBuffer(), idx1, idx2, idx3);
- } else {
- // indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
- put3s((ShortBuffer)indicesBuffer.getBuffer(), (short)idx1, (short)idx2, (short)idx3);
- }
- }
-
- @Override
protected void updateImpl(final GL2ES2 gl, final int curRenderModes) {
final boolean hasColorChannel = Region.hasColorChannel( curRenderModes );
final boolean hasColorTexture = Region.hasColorTexture( curRenderModes );
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index e149203f9..97948c204 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -27,26 +27,19 @@
*/
package jogamp.graph.curve.opengl;
-import java.io.PrintStream;
import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLUniformData;
-import com.jogamp.opengl.math.Vec3f;
-import com.jogamp.opengl.math.Vec4f;
-import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
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;
-import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureCoords;
@@ -55,12 +48,7 @@ import com.jogamp.opengl.util.texture.TextureSequence;
public final class VBORegionSPES2 extends GLRegion {
private final RenderState.ProgramLocal rsLocal;
- private int curVerticesCap = 0;
- private int curIndicesCap = 0;
- private GLArrayDataServer gca_VerticesAttr = null;
- private GLArrayDataServer gca_CurveParamsAttr = null;
- private GLArrayDataServer gca_ColorsAttr;
- private GLArrayDataServer indicesBuffer = null;
+ // Pass-1:
private final GLUniformData gcu_ColorTexUnit;
private final float[] colorTexBBox; // x0, y0, x1, y1
private final GLUniformData gcu_ColorTexBBox;
@@ -86,144 +74,8 @@ public final class VBORegionSPES2 extends GLRegion {
}
}
- private void initBuffer(final int verticeCount, final int indexCount) {
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), indexCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesBuffer.setGrowthFactor(growthFactor);
- curIndicesCap = indicesBuffer.getElemCapacity();
-
- gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_VerticesAttr.setGrowthFactor(growthFactor);
- gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_CurveParamsAttr.setGrowthFactor(growthFactor);
- if( hasColorChannel() ) {
- gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, verticeCount, GL.GL_STATIC_DRAW);
- gca_ColorsAttr.setGrowthFactor(growthFactor);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
-
- @Override
- public void growBuffer(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesBuffer.elemPosition() + indicesCount ) {
- indicesBuffer.growIfNeeded(indicesCount * indicesBuffer.getCompsPerElem());
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < gca_VerticesAttr.elemPosition() + verticesCount ) {
- gca_VerticesAttr.growIfNeeded(verticesCount * gca_VerticesAttr.getCompsPerElem());
- gca_CurveParamsAttr.growIfNeeded(verticesCount * gca_CurveParamsAttr.getCompsPerElem());
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.growIfNeeded(verticesCount * gca_ColorsAttr.getCompsPerElem());
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
- @Override
- public void setBufferCapacity(final int verticesCount, final int indicesCount) {
- if( curIndicesCap < indicesCount ) {
- indicesBuffer.reserve(indicesCount);
- curIndicesCap = indicesBuffer.getElemCapacity();
- }
- if( curVerticesCap < verticesCount ) {
- gca_VerticesAttr.reserve(verticesCount);
- gca_CurveParamsAttr.reserve(verticesCount);
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.reserve(verticesCount);
- }
- curVerticesCap = gca_VerticesAttr.getElemCapacity();
- }
- }
-
- @Override
- protected final void clearImpl(final GL2ES2 gl) {
- if(DEBUG_INSTANCE) {
- System.err.println("VBORegionSPES2 Clear: " + this);
- }
- if( null != indicesBuffer ) {
- indicesBuffer.clear(gl);
- }
- if( null != gca_VerticesAttr ) {
- gca_VerticesAttr.clear(gl);
- }
- if( null != gca_CurveParamsAttr ) {
- gca_CurveParamsAttr.clear(gl);
- }
- if( null != gca_ColorsAttr ) {
- gca_ColorsAttr.clear(gl);
- }
- }
-
- @Override
- public void printBufferStats(final PrintStream out) {
- final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegionSPES2: idx32 "+usesI32Idx());
- printAndCount(out, " indices ", indicesBuffer, size, capacity);
- out.println();
- printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
- out.println();
- printAndCount(out, " params ", gca_CurveParamsAttr, size, capacity);
- out.println();
- printAndCount(out, " color ", gca_ColorsAttr, size, capacity);
- final float filled = (float)size[0]/(float)capacity[0];
- out.println();
- out.printf(" total [bytes %,d / %,d], filled %.1f%%, left %.1f%%]%n",
- size[0], capacity[0], filled*100f, (1f-filled)*100f);
- }
-
- @Override
- protected final void pushVertex(final Vec3f coords, final Vec3f texParams, final Vec4f rgba) {
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushVertices(final Vec3f coords1, final Vec3f coords2, final Vec3f coords3,
- final Vec3f texParams1, final Vec3f texParams2, final Vec3f texParams3, final Vec4f rgba) {
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords1);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2);
- put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords3);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2);
- put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3);
- if( null != gca_ColorsAttr ) {
- if( null != rgba ) {
- final float r=rgba.x(), g=rgba.y(), b=rgba.z(), a=rgba.w();
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), r, g, b, a);
- } else {
- throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
- }
- }
- }
-
- @Override
- protected final void pushIndex(final int idx) {
- if( usesI32Idx() ) {
- indicesBuffer.puti(idx);
- } else {
- indicesBuffer.puts((short)idx);
- }
- }
-
@Override
- protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
- if( usesI32Idx() ) {
- put3i((IntBuffer)indicesBuffer.getBuffer(), idx1, idx2, idx3);
- } else {
- put3s((ShortBuffer)indicesBuffer.getBuffer(), (short)idx1, (short)idx2, (short)idx3);
- }
- }
+ protected final void clearImpl(final GL2ES2 gl) { }
@Override
protected void updateImpl(final GL2ES2 gl, final int curRenderModes) {