/** * Construct an update that will replace all of the data in {@code buffer}. * * @param buffer The buffer * @param <T> The precise type of buffer * * @return An update */ public static <T extends JCGLBufferWritableType> JCGLBufferUpdateType<T> newUpdateReplacingAll(final T buffer) { NullCheck.notNull(buffer); return JCGLBufferUpdates.newUpdateReplacingRange(buffer, buffer.getRange()); }
/** * Construct an update that will replace all of the data in {@code buffer}. * * @param buffer The buffer * @param <T> The precise type of buffer * * @return An update */ public static <T extends JCGLBufferWritableType> JCGLBufferUpdateType<T> newUpdateReplacingAll(final T buffer) { NullCheck.notNull(buffer, "Buffer"); return newUpdateReplacingRange(buffer, buffer.byteRange()); }
@Test public final void testBufferUpdateOutOfRange() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); this.expected.expect(RangeCheckException.class); JCGLBufferUpdates.newUpdateReplacingRange( a, new UnsignedRangeInclusiveL(0L, 200L)); } }
@Test public final void testBufferUpdateOutOfRange() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); this.expected.expect(RangeCheckException.class); JCGLBufferUpdates.newUpdateReplacingRange( a, new UnsignedRangeInclusiveL(0L, 200L)); } }