From 3d537d4239e3772ffdb33592e5e66844d94ac9f3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 24 Feb 2023 15:33:39 +0100 Subject: GLArrayData*: Shorten methods (*API Change*), use proper constructor and finalize immutables, add growthFactor (default golden ratio 1.618), add getCapacity*() and printStats(..) The growthFactor becomes essential for better growth behavior and can be set via setGrowthFactor(). The other changes were merely to clean up the GLArrayData interface and its 4 implementations. Not great to change its API, but one name was misleading ['getComponentCount' -> 'getCompsPerEleme'], so overall .. readability is enhanced. Motivation for this change was the performance analysis and improvement of our Graph Curve Renderer. --- src/jogl/classes/com/jogamp/opengl/GLArrayData.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/GLArrayData.java') diff --git a/src/jogl/classes/com/jogamp/opengl/GLArrayData.java b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java index ea2dfb0f3..972b10d4e 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLArrayData.java +++ b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java @@ -28,6 +28,7 @@ package com.jogamp.opengl; +import java.io.PrintStream; import java.nio.Buffer; import com.jogamp.opengl.fixedfunc.GLPointerFunc; @@ -159,26 +160,26 @@ public interface GLArrayData { /** * The number of components per element */ - public int getComponentCount(); + public int getCompsPerElem(); /** * The component's GL data type, ie. GL_FLOAT */ - public int getComponentType(); + public int getCompType(); /** * The component's size in bytes */ - public int getComponentSizeInBytes(); + public int getBytesPerComp(); /** * The current number of used elements. *

- * On element consist out of {@link #getComponentCount()} components. + * On element consist out of {@link #getCompsPerElem()} components. *

* In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position. */ - public int getElementCount(); + public int getElemCount(); /** * The currently used size in bytes.
@@ -186,6 +187,13 @@ public interface GLArrayData { */ public int getSizeInBytes(); + /** + * The current capacity in bytes. + */ + public int getCapacityInBytes(); + + public void printStats(final PrintStream out); + /** * True, if GL shall normalize fixed point data while converting * them into float. -- cgit v1.2.3