@Test public final void testIndexBufferBadSize() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); this.expected.expect(RangeCheckException.class); gi.indexBufferAllocate( -1L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); }
@Test public final void testIndexBufferBadSize() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); this.expected.expect(RangeCheckException.class); gi.indexBufferAllocate( -1L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); }
@Test public final void testIndexReadNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); }
@Test public final void testIndexReadDeleted() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferDelete(i); this.expected.expect(JCGLExceptionDeleted.class); gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); }
@Test public final void testIndexReadNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); }
@Test public final void testIndexReadDeleted() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferDelete(i); this.expected.expect(JCGLExceptionDeleted.class); gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); }
@Test public final void testIndexReallocateNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferReallocate(i); }
@Test public final void testIndexReallocateNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferReallocate(i); }
@Test public final void testIndexUpdateDeleted() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); gi.indexBufferDelete(i); this.expected.expect(JCGLExceptionDeleted.class); gi.indexBufferUpdate(u); }
@Test public final void testIndexUpdateDeleted() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); gi.indexBufferDelete(i); this.expected.expect(JCGLExceptionDeleted.class); gi.indexBufferUpdate(u); }
@Test public final void testIndexUpdateNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferUpdate(u); }
@Test public final void testIndexUpdateNotBound() { final Interfaces ii = this.getIndexBuffers("main"); final JCGLIndexBuffersType gi = ii.getIndexBuffers(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); gi.indexBufferUnbind(); this.expected.expect(JCGLExceptionBufferNotBound.class); gi.indexBufferUpdate(u); }
@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 testIndexBufferAllocateIdentity() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLIndexBufferType i0 = gi.indexBufferAllocate( 1000L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertEquals(1000L, i0.indices()); Assert.assertEquals(JCGLUnsignedType.TYPE_UNSIGNED_BYTE, i0.type()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, i0.usageHint()); Assert.assertFalse(i0.isDeleted()); }
@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 testIndexBufferAllocateIdentity() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLIndexBufferType i0 = gi.indexBufferAllocate( 1000L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertEquals(1000L, i0.getIndices()); Assert.assertEquals(JCGLUnsignedType.TYPE_UNSIGNED_BYTE, i0.getType()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, i0.getUsageHint()); Assert.assertFalse(i0.isDeleted()); }
@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 testIndexBufferReallocateIdentity() { final Interfaces i = this.getIndexBuffers("name"); final JCGLIndexBuffersType gi = i.getIndexBuffers(); final JCGLIndexBufferType i0 = gi.indexBufferAllocate( 1000L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); Assert.assertEquals(1000L, i0.indices()); Assert.assertEquals(JCGLUnsignedType.TYPE_UNSIGNED_BYTE, i0.type()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, i0.usageHint()); Assert.assertFalse(i0.isDeleted()); gi.indexBufferReallocate(i0); Assert.assertEquals(1000L, i0.indices()); Assert.assertEquals(JCGLUnsignedType.TYPE_UNSIGNED_BYTE, i0.type()); Assert.assertEquals(JCGLUsageHint.USAGE_STATIC_DRAW, i0.usageHint()); Assert.assertFalse(i0.isDeleted()); }