@Test public final void testArrayReadNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferRead(a, size -> ByteBuffer.allocateDirect((int) size)); Assert.fail(); } }
@Test public final void testArrayReadNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferRead(a, size -> ByteBuffer.allocateDirect((int) size)); Assert.fail(); } }
@Test public final void testArrayReallocateNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferReallocate(a); Assert.fail(); }
@Test public final void testArrayReallocateNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferReallocate(a); Assert.fail(); }
@Test public final void testArrayUpdateNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferUpdate(u); Assert.fail(); }
@Test public final void testArrayUpdateNotBound() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ga.arrayBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); ga.arrayBufferUpdate(u); Assert.fail(); }
@Test public final void testArrayBufferDeletion() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setAttributeIntegral( 0, a, 1, JCGLScalarIntegralType.TYPE_UNSIGNED_BYTE, 0, 0L); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); Assert.assertEquals(ao, go.arrayObjectGetCurrentlyBound()); ga.arrayBufferDelete(a); go.arrayObjectBind(ao); final Set<JCGLReferableType> refs = ao.getReferences(); Assert.assertEquals(1L, (long) refs.size()); Assert.assertTrue(refs.contains(a)); }
@Test public final void testArrayBufferDeletion() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); ga.arrayBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setAttributeIntegral( 0, a, 1, JCGLScalarIntegralType.TYPE_UNSIGNED_BYTE, 0, 0L); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); Assert.assertEquals(ao, go.arrayObjectGetCurrentlyBound()); ga.arrayBufferDelete(a); go.arrayObjectBind(ao); final Set<JCGLReferableType> refs = ao.references(); Assert.assertEquals(1L, (long) refs.size()); Assert.assertTrue(refs.contains(a)); }
final long sz = size.longValue(); final JCGLArrayBuffersType ga = g33.getArrayBuffers(); ga.arrayBufferUnbind(); return ga.arrayBufferAllocate(sz, array_usage); })); ga.arrayBufferBind(up.getBuffer()); ga.arrayBufferUpdate(up); ga.arrayBufferUnbind(); return up.getBuffer(); }));
size -> this.g.evaluate((g33, unused) -> { final JCGLArrayBuffersType ga = g33.arrayBuffers(); ga.arrayBufferUnbind(); final long sz = size.longValue(); return ga.arrayBufferAllocate(sz, array_usage); ga.arrayBufferBind(up.buffer()); ga.arrayBufferUpdate(up); ga.arrayBufferUnbind(); return up.buffer(); }));
@Test public final void testArrayBindIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); final JCGLArrayBufferType a0 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType a1 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a0); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a0)); Assert.assertEquals(Optional.of(a0), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a1); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferUnbind(); Assert.assertEquals(Optional.empty(), ga.arrayBufferGetCurrentlyBound()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); }
@Test public final void testArrayBindIdentities() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); final JCGLArrayBufferType a0 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferType a1 = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a0); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a0)); Assert.assertEquals(Optional.of(a0), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferBind(a1); Assert.assertTrue(ga.arrayBufferAnyIsBound()); Assert.assertTrue(ga.arrayBufferIsBound(a1)); Assert.assertEquals(Optional.of(a1), ga.arrayBufferGetCurrentlyBound()); ga.arrayBufferUnbind(); Assert.assertEquals(Optional.empty(), ga.arrayBufferGetCurrentlyBound()); Assert.assertFalse(ga.arrayBufferGetCurrentlyBound().isPresent()); Assert.assertFalse(ga.arrayBufferAnyIsBound()); }
this.g33_array_buffers.arrayBufferUnbind();
ga.arrayBufferUnbind(); this.mesh_needs_update = false;