@Test public final void testDrawElementsInstancedNoIndex() { final Interfaces i = this.getInterfaces("main"); final JCGLDrawType gd = i.getDraw(); this.expected.expect(JCGLExceptionBufferNotBound.class); gd.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_TRIANGLES, 100); }
@Test public final void testDrawElementsInstancedNoIndex() { final Interfaces i = this.getInterfaces("main"); final JCGLDrawType gd = i.getDraw(); this.expected.expect(JCGLExceptionBufferNotBound.class); gd.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_TRIANGLES, 100); }
@Override public <M> void onInstanceBatched( final R2MaterialOpaqueBatchedType<M> material, final R2InstanceBatchedType i) { this.shader_batched.onValidate(); this.array_objects.arrayObjectBind(i.arrayObject()); this.draw.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, i.renderCount()); }
@Override public <M> void onInstanceBatched( final R2MaterialDepthBatchedType<M> material, final R2InstanceBatchedType i) { material.shader().onValidate(); this.array_objects.arrayObjectBind(i.arrayObject()); this.draw.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, i.renderCount()); }
@Override public <M> void onInstanceBatched( final R2MaterialOpaqueBatchedType<M> material, final R2InstanceBatchedType i) { final R2ShaderInstanceBatchedUsableType<M> s = material.shader(); s.onValidate(); this.array_objects.arrayObjectBind(i.arrayObject()); this.draw.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, i.renderCount()); }
@Override public <M> void onInstanceBatched( final R2MaterialDepthBatchedType<M> material, final R2InstanceBatchedType i) { material.shader().onValidate(); this.array_objects.arrayObjectBind(i.arrayObject()); this.draw.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, i.renderCount()); }
private void renderBatches( final R2MatricesValuesType m, final R2MaskInstancesType s, final JCGLTextureUnitContextType up) { final JCGLArrayObjectsType g_a = this.g.getArrayObjects(); final JCGLDrawType g_d = this.g.getDraw(); final List<R2InstanceBatchedType> batches = s.batched(); if (!batches.isEmpty()) { this.shader_batched.onActivate(this.g); try { this.shader_batched.onReceiveViewValues( this.g, this.configureViewParameters()); this.shader_batched.onReceiveMaterialValues( this.g, this.configureMaterialParameters(up, Unit.unit())); for (int index = 0; index < batches.size(); ++index) { final R2InstanceBatchedType instance = batches.get(index); instance.update(this.g, m.transformContext()); g_a.arrayObjectBind(instance.arrayObject()); this.shader_batched.onValidate(); g_d.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, instance.renderCount()); } } finally { this.shader_batched.onDeactivate(this.g); g_a.arrayObjectUnbind(); } } }
g_sh.shaderUniformPutMatrix4x4f(u_projection, this.m_projection); g_d.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_TRIANGLES, 3); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
@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 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); }
g_sh.shaderUniformPutMatrix4x4f(u_projection, proj_matrix); g_d.drawElementsInstanced(JCGLPrimitives.PRIMITIVE_TRIANGLES, 3); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
shader.onValidate(); g_ao.arrayObjectBind(b.instance().arrayObject()); g_dr.drawElementsInstanced( JCGLPrimitives.PRIMITIVE_TRIANGLES, b.instance().renderCount());