@Test public final void testArrayRead() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); final ByteBuffer b = u.data(); for (int index = 0; index < 100; ++index) { b.put(index, (byte) 0x50); } ga.arrayBufferUpdate(u); final ByteBuffer e = ga.arrayBufferRead(a, size -> ByteBuffer.allocateDirect((int) size)); for (int index = 0; index < 100; ++index) { final long bv = (long) b.get(index); final long ev = (long) e.get(index); Assert.assertEquals("index " + index, bv, ev); } }
@Test public final void testArrayRead() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); final ByteBuffer b = u.getData(); for (int index = 0; index < 100; ++index) { b.put(index, (byte) 0x50); } ga.arrayBufferUpdate(u); final ByteBuffer e = ga.arrayBufferRead(a, size -> ByteBuffer.allocateDirect((int) size)); for (int index = 0; index < 100; ++index) { final long bv = (long) b.get(index); final long ev = (long) e.get(index); Assert.assertEquals("index " + index, bv, ev); } }
@Override public void update( final JCGLInterfaceGL33Type g, final R2TransformContextType context) { NullCheck.notNull(context); NullCheck.notNull(g); final JCGLArrayBuffersType g_ab = g.getArrayBuffers(); final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final FloatBuffer floats = this.update_vbo.getData().asFloatBuffer(); for (int index = this.used; index < this.max_size; ++index) { final int offset = Math.multiplyExact(index, 5); floats.put(offset + 0, 0.0f); floats.put(offset + 1, 0.0f); floats.put(offset + 2, 0.0f); floats.put(offset + 3, 0.0f); floats.put(offset + 4, 0.0f); } g_ao.arrayObjectBind(this.data_vao); g_ab.arrayBufferBind(this.data_vbo); g_ab.arrayBufferReallocate(this.data_vbo); g_ab.arrayBufferUpdate(this.update_vbo); g_ao.arrayObjectUnbind(); }
data.putFloat(base + 16, 1.0f); g_ab.arrayBufferUpdate(u); g_ab.arrayBufferUnbind();
data.putFloat(base + 16, 1.0f); g_ab.arrayBufferUpdate(u); g_ab.arrayBufferUnbind();
d.put(8, -0.5f); g_ab.arrayBufferUpdate(u); g_ab.arrayBufferUnbind();
@Test public final void testArrayUpdateDeleted() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ga.arrayBufferDelete(a); this.expected.expect(JCGLExceptionDeleted.class); ga.arrayBufferUpdate(u); Assert.fail(); }
@Test public final void testArrayUpdateDeleted() { final JCGLArrayBuffersType ga = this.getArrayBuffers("main"); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ga.arrayBufferDelete(a); this.expected.expect(JCGLExceptionDeleted.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 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(); }
@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 JCGLArrayBuffersType ga = g33.getArrayBuffers(); ga.arrayBufferBind(up.getBuffer()); ga.arrayBufferUpdate(up); ga.arrayBufferUnbind(); return up.getBuffer();
final JCGLArrayBuffersType ga = g33.arrayBuffers(); ga.arrayBufferBind(up.buffer()); ga.arrayBufferUpdate(up); ga.arrayBufferUnbind(); return up.buffer();
@Test public final void testArrayUpdateShared() { final JCGLSharedContextPair<JCGLArrayBuffersType> p = this.getArrayBuffersSharedWith("main", "alt"); final JCGLContextType ca = p.getMasterContext(); final JCGLContextType cb = p.getSlaveContext(); final JCGLArrayBuffersType ga = p.getMasterValue(); final JCGLArrayBuffersType gb = p.getSlaveValue(); Assert.assertTrue(ca.contextIsCurrent()); Assert.assertFalse(cb.contextIsCurrent()); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); gb.arrayBufferBind(a); gb.arrayBufferUpdate(u); }
@Test public final void testArrayUpdateShared() { final JCGLSharedContextPair<JCGLArrayBuffersType> p = this.getArrayBuffersSharedWith("main", "alt"); final JCGLContextType ca = p.getMasterContext(); final JCGLContextType cb = p.getSlaveContext(); final JCGLArrayBuffersType ga = p.getMasterValue(); final JCGLArrayBuffersType gb = p.getSlaveValue(); Assert.assertTrue(ca.contextIsCurrent()); Assert.assertFalse(cb.contextIsCurrent()); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); gb.arrayBufferBind(a); gb.arrayBufferUpdate(u); }
g_ab.arrayBufferBind(this.matrix_vbo); g_ab.arrayBufferReallocate(this.matrix_vbo); g_ab.arrayBufferUpdate(this.update_vbo); g_ao.arrayObjectUnbind();
@Test public final void testArrayUpdateWrongContext() { final JCGLUnsharedContextPair<JCGLArrayBuffersType> p = this.getArrayBuffersUnshared("main", "alt"); final JCGLContextType ca = p.getContextA(); final JCGLContextType cb = p.getContextB(); final JCGLArrayBuffersType ga = p.getValueA(); final JCGLArrayBuffersType gb = p.getValueB(); Assert.assertFalse(ca.contextIsCurrent()); Assert.assertTrue(cb.contextIsCurrent()); cb.contextReleaseCurrent(); ca.contextMakeCurrent(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); gb.arrayBufferUpdate(u); Assert.fail(); }
@Test public final void testArrayUpdateWrongContext() { final JCGLUnsharedContextPair<JCGLArrayBuffersType> p = this.getArrayBuffersUnshared("main", "alt"); final JCGLContextType ca = p.getContextA(); final JCGLContextType cb = p.getContextB(); final JCGLArrayBuffersType ga = p.getValueA(); final JCGLArrayBuffersType gb = p.getValueB(); Assert.assertFalse(ca.contextIsCurrent()); Assert.assertTrue(cb.contextIsCurrent()); cb.contextReleaseCurrent(); ca.contextMakeCurrent(); final JCGLArrayBufferType a = ga.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLBufferUpdateType<JCGLArrayBufferType> u = JCGLBufferUpdates.newUpdateReplacingAll(a); ca.contextReleaseCurrent(); cb.contextMakeCurrent(); this.expected.expect(JCGLExceptionWrongContext.class); gb.arrayBufferUpdate(u); Assert.fail(); }
this.g33_array_buffers.arrayBufferUpdate(u); this.g33_array_buffers.arrayBufferUnbind();
ga.arrayBufferUpdate(this.array_update); ga.arrayBufferUnbind(); this.mesh_needs_update = false;