@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()); }
@Override public void onFinish() { final JCGLArrayBuffersType g_ab = this.g.getArrayBuffers(); final JCGLIndexBuffersType g_ib = this.g.getIndexBuffers(); if (!this.errors.isEmpty()) { if (this.array_buffer != null) { g_ab.arrayBufferDelete(this.array_buffer); this.array_buffer = null; } if (this.index_buffer != null) { g_ib.indexBufferDelete(this.index_buffer); this.index_buffer = null; } } g_ab.arrayBufferUpdate(this.array_update); g_ib.indexBufferUpdate(this.index_update); this.array_object = this.g.getArrayObjects().arrayObjectAllocate(this.array_object_builder); }
@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 testArrayDeleteIdentity() { 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.arrayObjectDelete(ai); Assert.assertTrue(ai.isDeleted()); final Set<JCGLReferableType> ai_refs = ai.references(); Assert.assertEquals(0L, (long) ai_refs.size()); final Set<JCGLReferenceContainerType> a_refs = a.referringContainers(); Assert.assertEquals(0L, (long) a_refs.size()); }
@Test public final void testArrayDeleteIdentity() { 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.arrayObjectDelete(ai); Assert.assertTrue(ai.isDeleted()); final Set<JCGLReferableType> ai_refs = ai.getReferences(); Assert.assertEquals(0L, (long) ai_refs.size()); final Set<JCGLReferenceContainerType> a_refs = a.getReferringContainers(); Assert.assertEquals(0L, (long) a_refs.size()); }
@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 testDrawElementsOK() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLDrawType gd = i.getDraw(); final JCGLIndexBufferType ib = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setIndexBuffer(ib); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); gd.drawElements(JCGLPrimitives.PRIMITIVE_POINTS); }
@Test public final void testDrawElementsInstancedOK() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLDrawType gd = i.getDraw(); final JCGLIndexBufferType ib = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setIndexBuffer(ib); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); gd.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_POINTS, 1); }
@Test public final void testDrawElementsOK() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLDrawType gd = i.getDraw(); final JCGLIndexBufferType ib = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setIndexBuffer(ib); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); gd.drawElements(JCGLPrimitives.PRIMITIVE_POINTS); }
@Test public final void testDrawElementsInstancedOK() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLDrawType gd = i.getDraw(); final JCGLIndexBufferType ib = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setIndexBuffer(ib); final JCGLArrayObjectType ao = go.arrayObjectAllocate(b); gd.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_POINTS, 1); }
@Test public final void testArrayAllocateIndexDeleted() { final Interfaces is = this.getInterfaces("main"); final JCGLArrayBuffersType ga = is.getArrayBuffers(); final JCGLIndexBuffersType gi = is.getIndexBuffers(); final JCGLArrayObjectsType go = is.getArrayObjects(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); b.setIndexBuffer(i); gi.indexBufferDelete(i); this.expected.expect(JCGLExceptionDeleted.class); go.arrayObjectAllocate(b); Assert.fail(); }
@Test public final void testArrayDeleteDeleted() { 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.arrayObjectDelete(ai); this.expected.expect(JCGLExceptionDeleted.class); go.arrayObjectDelete(ai); Assert.fail(); }
@Test public final void testArrayDeleteDeleted() { 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.arrayObjectDelete(ai); this.expected.expect(JCGLExceptionDeleted.class); go.arrayObjectDelete(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 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 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 testArrayFromIdentities() { 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.setAttributeFloatingPointWithDivisor( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false, 23); b.setAttributeFloatingPoint( 1, a, 3, JCGLScalarType.TYPE_INT, 20, 4L, true); b.setAttributeIntegral( 2, a, 2, JCGLScalarIntegralType.TYPE_INT, 24, 8L); final JCGLArrayObjectType o = go.arrayObjectAllocate(b); final JCGLArrayObjectBuilderType c = go.arrayObjectNewBuilderFromObject(o); for (int index = 0; index < b.getMaximumVertexAttributes(); ++index) { Assert.assertEquals(b.getAttributeAt(index), c.getAttributeAt(index)); } }
static JCGLArrayObjectType getArrayObject( final JCGLInterfaceGL33Type g) { final JCGLArrayBuffersType g_ab = g.getArrayBuffers(); final JCGLIndexBuffersType g_ib = g.getIndexBuffers(); final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final JCGLIndexBufferType ib = g_ib.indexBufferAllocate( 3L, JCGLUnsignedType.TYPE_UNSIGNED_INT, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferUsableType a = g_ab.arrayBufferAllocate(3L * 4L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType aob = g_ao.arrayObjectNewBuilder(); aob.setAttributeFloatingPoint( 0, a, 3, JCGLScalarType.TYPE_FLOAT, 3 * 4, 0L, false); aob.setIndexBuffer(ib); final JCGLArrayObjectType ao = g_ao.arrayObjectAllocate(aob); g_ao.arrayObjectUnbind(); return ao; }