summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-06 05:12:01 +0100
committerSven Gothel <[email protected]>2023-03-06 05:12:01 +0100
commita3901230167c062be05c5b3fe350025f11bfd663 (patch)
treeb20fdfdcc704426cc1ab30c7fc9cadf702be0bb2 /src/jogl/classes/jogamp/graph/curve
parent4072655fe5c549949828ba86783b1fcc377869c8 (diff)
Graph: Region: Add perf counter (w/ API); Utilize put[34][sif](..); Fix indices growBufferSize(); Add GLRegion.create(..) w/ initial vertices/indices count; Up default[VI]Count;
Following heuristcs were found, hence we might want to calculate these for each font (TODO): /** * Heuristics with TestTextRendererNEWT00 text_1 + text_2 = 1334 chars * - FreeSans ~ vertices 64/char, indices 33/char * - Ubuntu Light ~ vertices 100/char, indices 50/char * - FreeSerif ~ vertices 115/char, indices 61/char * * Now let's assume a minimum of 10 chars will be rendered */
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java70
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java116
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java68
3 files changed, 169 insertions, 85 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index d948a06b4..b7a244f81 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 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:
@@ -31,7 +31,6 @@ import java.io.PrintStream;
import java.nio.FloatBuffer;
import com.jogamp.opengl.GL2ES2;
-import com.jogamp.opengl.GLArrayData;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLUniformData;
@@ -46,7 +45,6 @@ import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.Attachment;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.GLArrayDataClient;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.texture.Texture;
@@ -138,26 +136,27 @@ public class VBORegion2PMSAAES2 extends GLRegion {
}
}
- public VBORegion2PMSAAES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit) {
+ public VBORegion2PMSAAES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit,
+ final int initialVerticesCount, final int initialIndicesCount)
+ {
super(glp, renderModes, colorTexSeq);
rsLocal = new RenderState.ProgramLocal();
- final int initialElementCount = 256;
// We leave GLArrayDataClient.DEFAULT_GROWTH_FACTOR intact for avg +19% size, but 15% less CPU overhead compared to 1.2 (19% total)
// Pass 1:
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), initialIndicesCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
if( hasColorChannel() ) {
gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
} else {
gca_ColorsAttr = null;
}
@@ -196,8 +195,8 @@ public class VBORegion2PMSAAES2 extends GLRegion {
}
@Override
- protected void growBufferSize(final int verticeCount, final int indexCount) {
- indicesBuffer.growIfNeeded(indexCount);
+ public void growBufferSize(final int verticeCount, final int indexCount) {
+ indicesBuffer.growIfNeeded(indexCount * indicesBuffer.getCompsPerElem());
gca_VerticesAttr.growIfNeeded(verticeCount * gca_VerticesAttr.getCompsPerElem());
gca_CurveParamsAttr.growIfNeeded(verticeCount * gca_CurveParamsAttr.getCompsPerElem());
if( null != gca_ColorsAttr ) {
@@ -225,7 +224,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
@Override
public void printBufferStats(final PrintStream out) {
final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegion2PMSAAES2:");
+ out.println("VBORegion2PMSAAES2: idx32 "+usesI32Idx());
printAndCount(out, " indices ", indicesBuffer, size, capacity);
out.println();
printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
@@ -241,20 +240,36 @@ public class VBORegion2PMSAAES2 extends GLRegion {
@Override
protected final void pushVertex(final float[] coords, final float[] texParams, final 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]);
+ // 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]);
+ gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ if( null != gca_ColorsAttr ) {
+ if( null != rgba ) {
+ // gca_ColorsAttr.putf(rgba, 0, 4);
+ gca_ColorsAttr.put4f(rgba[0], rgba[1], rgba[2], rgba[3]);
+ } else {
+ throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
+ }
+ }
+ }
+ @Override
+ protected final void pushVertices(final float[] coords1, final float[] coords2, final float[] coords3,
+ final float[] texParams1, final float[] texParams2, final float[] texParams3, final float[] 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]);
+ 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]);
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]);
+ final float r=rgba[0], g=rgba[1], b=rgba[2], a=rgba[3];
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -271,6 +286,15 @@ public class VBORegion2PMSAAES2 extends GLRegion {
}
@Override
+ protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
+ if( usesI32Idx() ) {
+ indicesBuffer.put3i(idx1, idx2, idx3);
+ } else {
+ indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
+ }
+ }
+
+ @Override
protected void updateImpl(final GL2ES2 gl) {
// seal buffers
indicesBuffer.seal(gl, true);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index dc7bc692a..2998f3fe1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 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:
@@ -174,34 +174,19 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
}
- public VBORegion2PVBAAES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit) {
+ // private static final float growthFactor = 1.2f; // avg +5% size but 15% more overhead (34% total)
+ private static final float growthFactor = GLArrayDataClient.DEFAULT_GROWTH_FACTOR; // avg +20% size, but 15% less CPU overhead compared to 1.2 (19% total)
+
+ public VBORegion2PVBAAES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq, final int pass2TexUnit,
+ final int initialVerticesCount, final int initialIndicesCount)
+ {
super(glp, renderModes, colorTexSeq);
rsLocal = new RenderState.ProgramLocal();
- final int initialElementCount = 256;
- // final float growthFactor = 1.2f; // avg +5% size but 15% more overhead (34% total)
- final float growthFactor = GLArrayDataClient.DEFAULT_GROWTH_FACTOR; // avg +20% size, but 15% less CPU overhead compared to 1.2 (19% total)
-
// Pass 1:
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- indicesBuffer.setGrowthFactor(growthFactor);
-
- gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
- gca_VerticesAttr.setGrowthFactor(growthFactor);
-
- gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
- gca_CurveParamsAttr.setGrowthFactor(growthFactor);
+ growBufferSize(initialVerticesCount, initialIndicesCount);
- if( hasColorChannel() ) {
- gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
- gca_ColorsAttr.setGrowthFactor(growthFactor);
- } else {
- gca_ColorsAttr = null;
- }
if( hasColorTexture() ) {
gcu_ColorTexUnit = new GLUniformData(UniformNames.gcu_ColorTexUnit, colorTexSeq.getTextureUnit());
colorTexBBox = new float[4];
@@ -238,11 +223,35 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
@Override
- protected void growBufferSize(final int verticeCount, final int indexCount) {
- indicesBuffer.growIfNeeded(indexCount);
- gca_VerticesAttr.growIfNeeded(verticeCount * gca_VerticesAttr.getCompsPerElem());
- gca_CurveParamsAttr.growIfNeeded(verticeCount * gca_CurveParamsAttr.getCompsPerElem());
- if( null != gca_ColorsAttr ) {
+ public void growBufferSize(final int verticeCount, final int indexCount) {
+ if(null == indicesBuffer ) {
+ indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), indexCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesBuffer.setGrowthFactor(growthFactor);
+ } else {
+ indicesBuffer.growIfNeeded(indexCount * indicesBuffer.getCompsPerElem());
+ }
+ if( null == gca_VerticesAttr ) {
+ gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
+ false, verticeCount, GL.GL_STATIC_DRAW);
+ gca_VerticesAttr.setGrowthFactor(growthFactor);
+ } else {
+ gca_VerticesAttr.growIfNeeded(verticeCount * gca_VerticesAttr.getCompsPerElem());
+ }
+ if( null == gca_CurveParamsAttr ) {
+ gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
+ false, verticeCount, GL.GL_STATIC_DRAW);
+ gca_CurveParamsAttr.setGrowthFactor(growthFactor);
+ } else {
+ gca_CurveParamsAttr.growIfNeeded(verticeCount * gca_CurveParamsAttr.getCompsPerElem());
+ }
+
+ if( null == gca_ColorsAttr ) {
+ if( hasColorChannel() ) {
+ gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
+ false, verticeCount, GL.GL_STATIC_DRAW);
+ gca_ColorsAttr.setGrowthFactor(growthFactor);
+ }
+ } else {
gca_ColorsAttr.growIfNeeded(verticeCount * gca_ColorsAttr.getCompsPerElem());
}
}
@@ -254,7 +263,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
// Thread.dumpStack();
}
if( null != indicesBuffer ) {
- indicesBuffer.clear(gl);;
+ indicesBuffer.clear(gl);
}
if( null != gca_VerticesAttr ) {
gca_VerticesAttr.clear(gl);
@@ -271,7 +280,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
@Override
public void printBufferStats(final PrintStream out) {
final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegion2PVBAAES2:");
+ out.println("VBORegion2PVBAAES2: idx32 "+usesI32Idx());
printAndCount(out, " indices ", indicesBuffer, size, capacity);
out.println();
printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
@@ -287,20 +296,36 @@ public class VBORegion2PVBAAES2 extends GLRegion {
@Override
protected final void pushVertex(final float[] coords, final float[] texParams, final 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]);
+ // 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]);
+ gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ if( null != gca_ColorsAttr ) {
+ if( null != rgba ) {
+ // gca_ColorsAttr.putf(rgba, 0, 4);
+ gca_ColorsAttr.put4f(rgba[0], rgba[1], rgba[2], rgba[3]);
+ } else {
+ throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
+ }
+ }
+ }
+ @Override
+ protected final void pushVertices(final float[] coords1, final float[] coords2, final float[] coords3,
+ final float[] texParams1, final float[] texParams2, final float[] texParams3, final float[] 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]);
+ 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]);
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]);
+ final float r=rgba[0], g=rgba[1], b=rgba[2], a=rgba[3];
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -317,6 +342,15 @@ public class VBORegion2PVBAAES2 extends GLRegion {
}
@Override
+ protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
+ if( usesI32Idx() ) {
+ indicesBuffer.put3i(idx1, idx2, idx3);
+ } else {
+ indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
+ }
+ }
+
+ @Override
protected void updateImpl(final GL2ES2 gl) {
// seal buffers
indicesBuffer.seal(gl, true);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 03929b847..5a4c0c731 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2010 JogAmp Community. All rights reserved.
+ * Copyright 2010-2023 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:
@@ -60,25 +60,26 @@ public class VBORegionSPES2 extends GLRegion {
private final GLUniformData gcu_ColorTexBBox;
private ShaderProgram spPass1 = null;
- public VBORegionSPES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq) {
+ public VBORegionSPES2(final GLProfile glp, final int renderModes, final TextureSequence colorTexSeq,
+ final int initialVerticesCount, final int initialIndicesCount)
+ {
super(glp, renderModes, colorTexSeq);
rsLocal = new RenderState.ProgramLocal();
- final int initialElementCount = 256;
// We leave GLArrayDataClient.DEFAULT_GROWTH_FACTOR intact for avg +19% size, but 15% less CPU overhead compared to 1.2 (19% total)
- indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesBuffer = GLArrayDataServer.createData(3, glIdxType(), initialIndicesCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
if( hasColorChannel() ) {
gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ false, initialVerticesCount, GL.GL_STATIC_DRAW);
} else {
gca_ColorsAttr = null;
}
@@ -94,8 +95,8 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
- protected void growBufferSize(final int verticeCount, final int indexCount) {
- indicesBuffer.growIfNeeded(indexCount);
+ public void growBufferSize(final int verticeCount, final int indexCount) {
+ indicesBuffer.growIfNeeded(indexCount * indicesBuffer.getCompsPerElem());
gca_VerticesAttr.growIfNeeded(verticeCount * gca_VerticesAttr.getCompsPerElem());
gca_CurveParamsAttr.growIfNeeded(verticeCount * gca_CurveParamsAttr.getCompsPerElem());
if( null != gca_ColorsAttr ) {
@@ -125,7 +126,7 @@ public class VBORegionSPES2 extends GLRegion {
@Override
public void printBufferStats(final PrintStream out) {
final int[] size= { 0 }, capacity= { 0 };
- out.println("VBORegionSPES2:");
+ out.println("VBORegionSPES2: idx32 "+usesI32Idx());
printAndCount(out, " indices ", indicesBuffer, size, capacity);
out.println();
printAndCount(out, " vertices ", gca_VerticesAttr, size, capacity);
@@ -141,20 +142,36 @@ public class VBORegionSPES2 extends GLRegion {
@Override
protected final void pushVertex(final float[] coords, final float[] texParams, final 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]);
+ // 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]);
+ gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ if( null != gca_ColorsAttr ) {
+ if( null != rgba ) {
+ // gca_ColorsAttr.putf(rgba, 0, 4);
+ gca_ColorsAttr.put4f(rgba[0], rgba[1], rgba[2], rgba[3]);
+ } else {
+ throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
+ }
+ }
+ }
+ @Override
+ protected final void pushVertices(final float[] coords1, final float[] coords2, final float[] coords3,
+ final float[] texParams1, final float[] texParams2, final float[] texParams3, final float[] 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]);
+ 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]);
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]);
+ final float r=rgba[0], g=rgba[1], b=rgba[2], a=rgba[3];
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
+ gca_ColorsAttr.put4f(r, g, b, a);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -171,6 +188,15 @@ public class VBORegionSPES2 extends GLRegion {
}
@Override
+ protected final void pushIndices(final int idx1, final int idx2, final int idx3) {
+ if( usesI32Idx() ) {
+ indicesBuffer.put3i(idx1, idx2, idx3);
+ } else {
+ indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
+ }
+ }
+
+ @Override
protected void updateImpl(final GL2ES2 gl) {
// seal buffers
gca_VerticesAttr.seal(gl, true);