@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(); }
g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
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_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final JCGLClearType g_c = g.getClear(); final JCGLDrawType g_d = g.getDraw(); final JCGLShadersType g_sh = g.getShaders(); /** * Clear the window. */ g_c.clear(this.clear); /** * Activate the program, bind the created array object, draw a triangle. */ g_sh.shaderActivateProgram(this.program); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.arrayObjects(); final JCGLClearType g_c = g.clearing(); final JCGLDrawType g_d = g.drawing(); final JCGLShadersType g_sh = g.shaders(); /* * Clear the window. */ g_c.clear(this.clear); /* * Activate the program, bind the created array object, draw a triangle. */ g_sh.shaderActivateProgram(this.program); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram();
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.arrayObjects(); final JCGLClearType g_c = g.clearing(); final JCGLDrawType g_d = g.drawing(); final JCGLShadersType g_sh = g.shaders(); final JCGLTexturesType g_tex = g.textures(); /* * Clear the window. */ g_c.clear(this.clear); /* * Activate the program, bind the created array object, draw a triangle. */ final List<JCGLTextureUnitType> units = g_tex.textureGetUnits(); final JCGLTextureUnitType u0 = units.get(0); g_tex.texture2DBind(u0, this.texture); g_sh.shaderActivateProgram(this.program); g_sh.shaderUniformPutTexture2DUnit(this.texture_uniform, u0); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
@Override public void onRender(final JCGLInterfaceGL33Type g) { final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final JCGLClearType g_c = g.getClear(); final JCGLDrawType g_d = g.getDraw(); final JCGLShadersType g_sh = g.getShaders(); final JCGLTexturesType g_tex = g.getTextures(); /** * Clear the window. */ g_c.clear(this.clear); /** * Activate the program, bind the created array object, draw a triangle. */ final List<JCGLTextureUnitType> units = g_tex.textureGetUnits(); final JCGLTextureUnitType u0 = units.get(0); g_tex.texture2DBind(u0, this.texture); g_sh.shaderActivateProgram(this.program); g_sh.shaderUniformPutTexture2DUnit(this.texture_uniform, u0); g_ao.arrayObjectBind(this.array_object); g_d.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); g_ao.arrayObjectUnbind(); g_sh.shaderDeactivateProgram(); }
ga.arrayObjectBind(this.quad); gd.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); ga.arrayObjectUnbind(); gs.shaderDeactivateProgram(); gf.framebufferDrawUnbind();
private void clearStencilForClipVolume() { JCGLRenderStates.activate(this.g33, this.clip_screen_stencil_state); final JCGLTextureUnitContextType tc = this.input_state.light_base_context.unitContextNew(); try { this.clip_screen_stencil.onActivate(this.g33); try { this.clip_screen_stencil.onReceiveViewValues( this.g33, this.configureViewParameters()); this.clip_screen_stencil.onReceiveMaterialValues( this.g33, this.configureMaterialParameters(tc, Unit.unit())); this.clip_screen_stencil.onValidate(); this.array_objects.arrayObjectBind(this.quad.arrayObject()); try { this.draw.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); } finally { this.array_objects.arrayObjectUnbind(); } } finally { this.clip_screen_stencil.onDeactivate(this.g33); } } finally { tc.unitContextFinish(this.textures); } }
g_ab.arrayBufferReallocate(this.matrix_vbo); g_ab.arrayBufferUpdate(this.update_vbo); g_ao.arrayObjectUnbind();
static JCGLArrayObjectType getArrayObject( final JCGLInterfaceGL33Type g) { final JCGLArrayBuffersType g_ab = g.getArrayBuffers(); final JCGLIndexBuffersType g_ib = g.getIndexBuffers(); final JCGLArrayObjectsType g_ao = g.getArrayObjects(); final JCGLIndexBufferType ib = g_ib.indexBufferAllocate( 3L, JCGLUnsignedType.TYPE_UNSIGNED_INT, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayBufferUsableType a = g_ab.arrayBufferAllocate(3L * 4L, JCGLUsageHint.USAGE_STATIC_DRAW); final JCGLArrayObjectBuilderType aob = g_ao.arrayObjectNewBuilder(); aob.setAttributeFloatingPoint( 0, a, 3, JCGLScalarType.TYPE_FLOAT, 3 * 4, 0L, false); aob.setIndexBuffer(ib); final JCGLArrayObjectType ao = g_ao.arrayObjectAllocate(aob); g_ao.arrayObjectUnbind(); return ao; }
t.draw.drawElements(JCGLPrimitives.PRIMITIVE_TRIANGLES); } finally { t.array_objects.arrayObjectUnbind();
@Test public final void testArrayBindIdentity() { 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.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); final JCGLArrayObjectType ao1 = go.arrayObjectAllocate(b); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao0); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao1); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectUnbind(); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }
@Test public final void testArrayBindIdentity() { 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.setAttributeFloatingPoint( 0, a, 4, JCGLScalarType.TYPE_FLOAT, 16, 0L, false); final JCGLArrayObjectType ao0 = go.arrayObjectAllocate(b); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); final JCGLArrayObjectType ao1 = go.arrayObjectAllocate(b); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao0); Assert.assertEquals(ao0, go.arrayObjectGetCurrentlyBound()); go.arrayObjectBind(ao1); Assert.assertEquals(ao1, go.arrayObjectGetCurrentlyBound()); go.arrayObjectUnbind(); Assert.assertEquals( go.arrayObjectGetDefault(), go.arrayObjectGetCurrentlyBound()); }