@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)); } }
aob.setIndexBuffer(ib); aob.setAttributeFloatingPoint( 0, ab, 0, false); aob.setAttributeFloatingPoint( 1, ab,
@Test public final void testFloatingArrayAlreadyAssigned() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setStrictChecking(true); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); this.expected.expect(JCGLExceptionAttributeAlreadyAssigned.class); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); Assert.fail(); }
@Test public final void testIntegralArrayAlreadyAssigned() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setStrictChecking(true); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); this.expected.expect(JCGLExceptionAttributeAlreadyAssigned.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
@Test public final void testFloatingArrayBadIndex() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeFloatingPoint( -1, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); Assert.fail(); }
@Test public final void testIntegralArrayBadElements1() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 5, JCGLScalarIntegralType.TYPE_INT, 16, 0L); Assert.fail(); }
aob.setIndexBuffer(this.index_buffer); aob.setAttributeFloatingPoint( 0, this.array_buffer, aob.setAttributeFloatingPointWithDivisor( 1, this.matrices_buffer, false, 1); aob.setAttributeFloatingPointWithDivisor( 2, this.matrices_buffer, false, 1); aob.setAttributeFloatingPointWithDivisor( 3, this.matrices_buffer, false, 1); aob.setAttributeFloatingPointWithDivisor( 4, this.matrices_buffer,
@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); }
JCGLBufferUpdates.newUpdateReplacingAll(this.index_buffer); this.array_object_builder.setIndexBuffer(this.index_buffer); for (final Integer in_index : this.attributes_by_index.keySet()) { final Attribute attr = this.attributes_by_index.get(in_index); case TYPE_SHORT: case TYPE_BYTE: { this.array_object_builder.setAttributeIntegral( in_index.intValue(), this.array_buffer, this.array_object_builder.setAttributeFloatingPoint( in_index.intValue(), this.array_buffer,
Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); b.setIndexBuffer(ib);
@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); }
aob.setStrictChecking(true); aob.setAttributeFloatingPoint( R2AttributeConventions.POSITION_ATTRIBUTE_INDEX, vbo, false); offset += 3L * 4L; aob.setAttributeFloatingPoint( R2AttributeConventions.BILLBOARDED_ATTRIBUTE_SCALE_INDEX, vbo, false); offset += 4L; aob.setAttributeFloatingPoint( R2AttributeConventions.BILLBOARDED_ATTRIBUTE_ROTATION_INDEX, vbo,
aob.setStrictChecking(true); aob.setAttributeFloatingPointWithDivisor( R2AttributeConventions.BATCHED_MODEL_MATRIX_COLUMN_0_ATTRIBUTE_INDEX, vbo, 1); offset += 4L * 4L; aob.setAttributeFloatingPointWithDivisor( R2AttributeConventions.BATCHED_MODEL_MATRIX_COLUMN_1_ATTRIBUTE_INDEX, vbo, 1); offset += 4L * 4L; aob.setAttributeFloatingPointWithDivisor( R2AttributeConventions.BATCHED_MODEL_MATRIX_COLUMN_2_ATTRIBUTE_INDEX, vbo, 1); offset += 4L * 4L; aob.setAttributeFloatingPointWithDivisor( R2AttributeConventions.BATCHED_MODEL_MATRIX_COLUMN_3_ATTRIBUTE_INDEX, vbo,
final int max = b.getMaximumVertexAttributes(); this.checkArrayAttributes(bb, max);
@Test public final void testArrayGetBadIndex() { final Interfaces i = this.getInterfaces("main"); final JCGLArrayObjectsType go = i.getArrayObjects(); final JCGLArrayObjectBuilderType b = go.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.getAttributeAt(-1); Assert.fail(); }
throws JCGLExceptionDeleted, JCGLExceptionAttributeAlreadyAssigned this.setAttributeFloatingPointWithDivisor( index, a, elements, type, stride, offset, normalized, 0);
aob.setAttributeFloatingPoint( R2AttributeConventions.POSITION_ATTRIBUTE_INDEX, this.array, (long) R2VertexP32RGBA8ByteBuffered.metaPositionStaticOffsetFromType(), false); aob.setAttributeFloatingPoint( R2AttributeConventions.POSITION_ATTRIBUTE_INDEX + 1, this.array,
@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 testFloatingArrayBadStride() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, -1, 0L, false); Assert.fail(); }
@Test public final void testIntegralArrayBadStride() { final Interfaces i_main = this.getInterfaces("main"); final JCGLArrayBuffersType ga_main = i_main.getArrayBuffers(); final JCGLArrayObjectsType go_main = i_main.getArrayObjects(); final JCGLArrayBufferType a = ga_main.arrayBufferAllocate(100L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType b = go_main.arrayObjectNewBuilder(); Assert.assertTrue(b.getMaximumVertexAttributes() >= 16); this.expected.expect(RangeCheckException.class); b.setAttributeIntegral( 0, a, 4, JCGLScalarIntegralType.TYPE_INT, -1, 0L); Assert.fail(); }