@Test public final void testIndexRead() { 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); final ByteBuffer b = u.getData(); for (int index = 0; index < 100; ++index) { b.put(index, (byte) 0x50); } gi.indexBufferUpdate(u); final ByteBuffer e = gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); for (int index = 0; index < 100; ++index) { Assert.assertEquals((long) b.get(index), (long) e.get(index)); } }
i.put(5, 3); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
@Test public final void testIndexRead() { 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); final ByteBuffer b = u.data(); for (int index = 0; index < 100; ++index) { b.put(index, (byte) 0x50); } gi.indexBufferUpdate(u); final ByteBuffer e = gi.indexBufferRead(i, size -> ByteBuffer.allocateDirect((int) size)); for (int index = 0; index < 100; ++index) { Assert.assertEquals((long) b.get(index), (long) e.get(index)); } }
i.put(5, 3); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
i.put(2, 2); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
i.put(2, 2); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
i.put(2, 2); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
@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); }
d.put(23, (short) 7); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();
@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); }
final JCGLIndexBuffersType gi = g33.getIndexBuffers(); gi.indexBufferBind(up.getBuffer()); gi.indexBufferUpdate(up); gi.indexBufferUnbind(); return up.getBuffer();
final JCGLIndexBuffersType gi = g33.indexBuffers(); gi.indexBufferBind(up.buffer()); gi.indexBufferUpdate(up); gi.indexBufferUnbind(); return up.buffer();
@Test public final void testIndexUpdateShared() { final JCGLSharedContextPair<JCGLIndexBuffersType> p = this.getIndexBuffersSharedWith("main", "alt"); final JCGLContextType ca = p.getMasterContext(); final JCGLContextType cb = p.getSlaveContext(); final JCGLIndexBuffersType gi = p.getMasterValue(); final JCGLIndexBuffersType gb = p.getSlaveValue(); Assert.assertTrue(ca.contextIsCurrent()); Assert.assertFalse(cb.contextIsCurrent()); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); gb.indexBufferBind(i); gb.indexBufferUpdate(u); }
@Test public final void testIndexUpdateShared() { final JCGLSharedContextPair<JCGLIndexBuffersType> p = this.getIndexBuffersSharedWith("main", "alt"); final JCGLContextType ca = p.getMasterContext(); final JCGLContextType cb = p.getSlaveContext(); final JCGLIndexBuffersType gi = p.getMasterValue(); final JCGLIndexBuffersType gb = p.getSlaveValue(); Assert.assertTrue(ca.contextIsCurrent()); Assert.assertFalse(cb.contextIsCurrent()); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); gb.indexBufferBind(i); gb.indexBufferUpdate(u); }
@Test public final void testIndexUpdateWrongContext() { final JCGLUnsharedContextPair<JCGLIndexBuffersType> p = this.getIndexBuffersUnshared("main", "alt"); final JCGLContextType ca = p.getContextA(); final JCGLContextType cb = p.getContextB(); final JCGLIndexBuffersType gi = p.getValueA(); final JCGLIndexBuffersType gb = p.getValueB(); Assert.assertFalse(ca.contextIsCurrent()); Assert.assertTrue(cb.contextIsCurrent()); cb.contextReleaseCurrent(); ca.contextMakeCurrent(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); gb.indexBufferUpdate(u); }
@Test public final void testIndexUpdateWrongContext() { final JCGLUnsharedContextPair<JCGLIndexBuffersType> p = this.getIndexBuffersUnshared("main", "alt"); final JCGLContextType ca = p.getContextA(); final JCGLContextType cb = p.getContextB(); final JCGLIndexBuffersType gi = p.getValueA(); final JCGLIndexBuffersType gb = p.getValueB(); Assert.assertFalse(ca.contextIsCurrent()); Assert.assertTrue(cb.contextIsCurrent()); cb.contextReleaseCurrent(); ca.contextMakeCurrent(); final JCGLIndexBufferType i = gi.indexBufferAllocate( 100L, JCGLUnsignedType.TYPE_UNSIGNED_BYTE, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLIndexBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(i); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); gb.indexBufferUpdate(u); }
d.put(5, (short) 3); g_ib.indexBufferUpdate(u); g_ib.indexBufferUnbind();