summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-07 18:05:15 +0100
committerSven Gothel <[email protected]>2023-03-07 18:05:15 +0100
commit657df3d32a291a74e7eb31c8ccef0fde151afcc1 (patch)
tree006344b5f080fba866b990cf93f2555385d43813 /src/jogl/classes/jogamp/graph/curve/opengl
parent90a95e6f689b479f3c3ae3caf4e30447030c7682 (diff)
Graph Perf: Region*: Rely on growBuffer(..) per addOutlineShape() and known buffer data-type to directly put[34][sif](..) skipping GLArrayDataClient/Buffers buffer-growth and validations
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java34
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java44
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java34
3 files changed, 62 insertions, 50 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index b7a244f81..cf4fc65fc 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -29,6 +29,8 @@ 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;
@@ -240,15 +242,11 @@ public class VBORegion2PMSAAES2 extends GLRegion {
@Override
protected final void pushVertex(final float[] coords, final float[] texParams, final float[] 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]);
- gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords[0], coords[1], coords[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), 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]);
+ put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba[0], rgba[1], rgba[2], rgba[3]);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -258,18 +256,18 @@ public class VBORegion2PMSAAES2 extends GLRegion {
@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]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords1[0], coords1[1], coords1[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2[0], coords2[1], coords2[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords3[0], coords3[1], coords3[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1[0], texParams1[1], texParams1[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2[0], texParams2[1], texParams2[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3[0], texParams3[1], texParams3[2]);
if( null != gca_ColorsAttr ) {
if( null != rgba ) {
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);
+ 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");
}
@@ -288,9 +286,9 @@ 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);
+ 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);
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 2998f3fe1..e5dcfeb84 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -29,6 +29,8 @@ 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;
@@ -299,12 +301,15 @@ public class VBORegion2PVBAAES2 extends GLRegion {
// 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]);
+ // gca_VerticesAttr.put3f(coords[0], coords[1], coords[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords[0], coords[1], coords[2]);
+ // gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), 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]);
+ // gca_ColorsAttr.put4f(rgba[0], rgba[1], rgba[2], rgba[3]);
+ put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba[0], rgba[1], rgba[2], rgba[3]);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -314,18 +319,27 @@ public class VBORegion2PVBAAES2 extends GLRegion {
@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]);
+ // 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[0], coords1[1], coords1[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2[0], coords2[1], coords2[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), 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]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1[0], texParams1[1], texParams1[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2[0], texParams2[1], texParams2[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3[0], texParams3[1], texParams3[2]);
if( null != gca_ColorsAttr ) {
if( null != rgba ) {
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);
+ // 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");
}
@@ -344,9 +358,11 @@ 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);
+ // indicesBuffer.put3i(idx1, idx2, idx3);
+ put3i((IntBuffer)indicesBuffer.getBuffer(), idx1, idx2, idx3);
} else {
- indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
+ // indicesBuffer.put3s((short)idx1, (short)idx2, (short)idx3);
+ put3s((ShortBuffer)indicesBuffer.getBuffer(), (short)idx1, (short)idx2, (short)idx3);
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 5a4c0c731..dcd5831d4 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -29,6 +29,8 @@ 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;
@@ -142,15 +144,11 @@ public class VBORegionSPES2 extends GLRegion {
@Override
protected final void pushVertex(final float[] coords, final float[] texParams, final float[] 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]);
- gca_CurveParamsAttr.put3f(texParams[0], texParams[1], texParams[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords[0], coords[1], coords[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), 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]);
+ put4f((FloatBuffer)gca_ColorsAttr.getBuffer(), rgba[0], rgba[1], rgba[2], rgba[3]);
} else {
throw new IllegalArgumentException("Null color given for COLOR_CHANNEL rendering mode");
}
@@ -160,18 +158,18 @@ public class VBORegionSPES2 extends GLRegion {
@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]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords1[0], coords1[1], coords1[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords2[0], coords2[1], coords2[2]);
+ put3f((FloatBuffer)gca_VerticesAttr.getBuffer(), coords3[0], coords3[1], coords3[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams1[0], texParams1[1], texParams1[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams2[0], texParams2[1], texParams2[2]);
+ put3f((FloatBuffer)gca_CurveParamsAttr.getBuffer(), texParams3[0], texParams3[1], texParams3[2]);
if( null != gca_ColorsAttr ) {
if( null != rgba ) {
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);
+ 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");
}
@@ -190,9 +188,9 @@ 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);
+ 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);
}
}