@Test public final void testArrayBindIdentity() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); final JCGLArrayObjectType ao1 = go.arrayObjectAllocate(b); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao0); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao1); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectUnbind(); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }
@Test public final void testArrayBindIdentity() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); final JCGLArrayObjectType ao1 = go.arrayObjectAllocate(b); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao0); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao1); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectUnbind(); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }
@Test public final void testIndexBufferBindIdentity() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLArrayObjectsType ga = i.getArrayObjects(); final JCGLArrayObjectUsableType a0 = ga.arrayObjectGetDefault(); final Set<JCGLReferableType> a0_refs = a0.references(); final JCGLIndexBufferType i0 = gi.indexBufferAllocate( 1000L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final Set<JCGLReferenceContainerType> i0_refs = i0.referringContainers(); Assert.assertEquals(Optional.of(i0), gi.indexBufferGetCurrentlyBound()); Assert.assertEquals(Optional.of(i0), a0.indexBufferBound()); Assert.assertEquals(1L, (long) a0_refs.size()); Assert.assertTrue(a0_refs.contains(i0)); Assert.assertEquals(1L, (long) i0_refs.size()); Assert.assertTrue(i0_refs.contains(a0)); gi.indexBufferUnbind(); Assert.assertEquals(a0, ga.arrayObjectGetCurrentlyBound()); Assert.assertEquals(Optional.empty(), gi.indexBufferGetCurrentlyBound()); Assert.assertEquals(Optional.empty(), a0.indexBufferBound()); Assert.assertEquals(0L, (long) a0_refs.size()); Assert.assertEquals(0L, (long) a0_refs.size()); Assert.assertEquals(0L, (long) i0_refs.size()); }
final Set<JCGLReferenceContainerType> i0_refs = i0.getReferringContainers(); Assert.assertEquals(a1, ga.arrayObjectGetCurrentlyBound()); Assert.assertEquals(Optional.of(i0), gi.indexBufferGetCurrentlyBound()); Assert.assertEquals(Optional.of(i0), a1.getIndexBufferBound()); Assert.assertEquals(a1, ga.arrayObjectGetCurrentlyBound()); Assert.assertEquals(Optional.empty(), gi.indexBufferGetCurrentlyBound()); Assert.assertEquals(Optional.empty(), a1.getIndexBufferBound());
final JCGLArrayObjectType ai_2 = go.arrayObjectAllocate(b); Assert.assertEquals(go.arrayObjectGetCurrentlyBound(), ai_2); Assert.assertEquals(Optional.of(ib), ai_0.indexBufferBound()); Assert.assertEquals(Optional.of(ib), ai_1.indexBufferBound());
final JCGLArrayObjectType ai_2 = go.arrayObjectAllocate(b); Assert.assertEquals(go.arrayObjectGetCurrentlyBound(), ai_2); Assert.assertEquals(Optional.of(ib), ai_0.getIndexBufferBound()); Assert.assertEquals(Optional.of(ib), ai_1.getIndexBufferBound());
@Test public final void testArrayBindDeleteBindPreserves() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType a0 = go.arrayObjectAllocate(b); final JCGLArrayObjectType a1 = go.arrayObjectAllocate(b); go.arrayObjectBind(a0); Assert.assertEquals(a0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(a1); Assert.assertEquals(a0, go.arrayObjectGetCurrentlyBound()); }
@Test public final void testArrayBindDeleteBindPreserves() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType a0 = go.arrayObjectAllocate(b); final JCGLArrayObjectType a1 = go.arrayObjectAllocate(b); go.arrayObjectBind(a0); Assert.assertEquals(a0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(a1); Assert.assertEquals(a0, go.arrayObjectGetCurrentlyBound()); }
@Test public final void testArrayBindDeleteBind() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ai = go.arrayObjectAllocate(b); go.arrayObjectBind(ai); Assert.assertEquals(ai, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(ai); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }
@Test public final void testArrayBindDeleteBind() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ai = go.arrayObjectAllocate(b); go.arrayObjectBind(ai); Assert.assertEquals(ai, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(ai); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }
@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)); }
@Test public final void testArrayBindDeleted() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ai = go.arrayObjectAllocate(b); Assert.assertEquals(ai, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(ai); this.expected.expect(JCGLExceptionDeleted.class); go.arrayObjectBind(ai); Assert.fail(); }
@Test public final void testArrayBindDeleted() { 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); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ai = go.arrayObjectAllocate(b); Assert.assertEquals(ai, go.arrayObjectGetCurrentlyBound()); go.arrayObjectDelete(ai); this.expected.expect(JCGLExceptionDeleted.class); go.arrayObjectBind(ai); Assert.fail(); }
@Test public final void testArrayBindIndexRebindDisallowed1() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLIndexBufferType ib0 = gi.indexBufferAllocate( 10L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayBufferType ab = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setAttributeFloatingPoint( 0, ab, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); this.expected.expect(JCGLExceptionIndexBufferAlreadyConfigured.class); gi.indexBufferBind(ib0); }
@Test public final void testArrayBindIndexRebindDisallowed0() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayBuffersType ga = i.getArrayBuffers(); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLIndexBufferType ib0 = gi.indexBufferAllocate( 10L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLIndexBufferType ib1 = gi.indexBufferAllocate( 10L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayBufferType ab = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setIndexBuffer(ib0); b.setAttributeFloatingPoint( 0, ab, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); this.expected.expect(JCGLExceptionIndexBufferAlreadyConfigured.class); gi.indexBufferBind(ib1); }