From af201b19064d2526743c89c218a51b0a3ee837c2 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 20 Mar 2023 14:22:15 +0100 Subject: GLArrayDataClient: Allow null buffer @ growIfNeeded(), removed from commit 90a95e6f689b479f3c3ae3caf4e30447030c7682 A null buffer is possible in case initialElementCount at ctor is <= 0 --- .../com/jogamp/opengl/util/GLArrayDataClient.java | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index e5f9e5336..687eb8a4c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -437,23 +437,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @return true if buffer size has changed, i.e. grown. Otherwise false. */ public final boolean growIfNeeded(final int spareComponents) { - if( buffer.remaining() < spareComponents ) { - if( 0 != mappedElemCount ) { - throw new GLException("Mapped buffer can't grow. Insufficient storage size: Needed "+spareComponents+" components, "+ - "mappedElementCount "+mappedElemCount+ - ", has mapped buffer "+buffer+"; "+this); - } - final int has_comps = buffer.capacity(); - final int required_elems = compsToElemCount(has_comps + spareComponents); - final int new_elems = compsToElemCount( (int)( has_comps * growthFactor + 0.5f ) ); - final int elementCount = Math.max( new_elems, required_elems ); - return reserve( elementCount ); - } - return false; - } - - public final boolean growIfNeeded0(final int spareComponents) { - if( buffer==null || buffer.remaining() max("+new_elems+", "+required_elems+") -> "+elementCount); - } return reserve( elementCount ); } } -- cgit v1.2.3