Java Code Examples for com.jogamp.opengl.GL4#glBindBufferBase()
The following examples show how to use
com.jogamp.opengl.GL4#glBindBufferBase() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Gl_420_clipping.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 0.5f).put(2, 0).put(3, 1)); // Bind rendering objects gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); return true; }
Example 2
Source File: Gl_420_test_depth_conservative.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth.put(0, 1.0f)); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 5, 0, 0); return true; }
Example 3
Source File: Gl_320_draw_instanced.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, 2 * Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 modelA = new Mat4(1.0f).translate(new Vec3(-1.1f, 0.0f, 0.0f)); Mat4 modelB = new Mat4(1.0f).translate(new Vec3(1.1f, 0.0f, 0.0f)); pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(modelA).toFa_()); pointer.position(Mat4.SIZE); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(modelB).toFa_()); pointer.rewind(); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewport(0, 0, windowSize.x, windowSize.y); float[] depth = new float[]{1.0f}; gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0); gl4.glUseProgram(programName); gl4.glUniformBlockBinding(programName, uniformTransform, Semantic.Uniform.TRANSFORM0); gl4.glUniformBlockBinding(programName, uniformMaterial, Semantic.Uniform.MATERIAL); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 2); return true; }
Example 4
Source File: Gl_420_draw_base_instance.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth.put(0, 1)); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 1).put(2, 1).put(3, 1)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 1 * Integer.BYTES, // indices offset 5, // instance count 2, // base vertex 5); // base instance return true; }
Example 5
Source File: Gl_450_culling.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 0.5f, 0.0f, 1.0f}, 0); // Bind rendering objects gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); return true; }
Example 6
Source File: Gl_500_buffer_pinned_amd.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor); // Bind rendering objects gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); return true; }
Example 7
Source File: Gl_440_buffer_type.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { // Compute the MVP (Model View Projection matrix) float aspect = (windowSize.x * 0.33f) / (windowSize.y * 0.50f); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, aspect, 0.1f, 100.0f); Mat4 mvp = projection.mul(viewMat4()).mul(new Mat4(1.0f)); uniformPointer.asFloatBuffer().put(mvp.toFa_()); } gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); for (int index = 0; index < Viewport.MAX; ++index) { gl4.glViewportIndexedf(0, viewport[index].viewport.x, viewport[index].viewport.y, viewport[index].viewport.z, viewport[index].viewport.w); gl4.glBindVertexArray(vertexArrayName.get(viewport[index].vertexFormat)); gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1); } return true; }
Example 8
Source File: Gl_430_query_occlusion.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } // Set the display viewport gl4.glViewport(0, 0, windowSize.x, windowSize.y); // Clear color buffer with black gl4.glClearBufferfv(GL_COLOR, 0, new float[]{0.0f, 0.0f, 0.0f, 1.0f}, 0); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); // Samples count query gl4.glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, queryName.get(0)); { gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1); } gl4.glEndQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE); // Get the count of samples. // If the result of the query isn't here yet, we wait here... int[] samplesCount = {0}; gl4.glGetQueryObjectuiv(queryName.get(0), GL_QUERY_RESULT, samplesCount, 0); System.out.println("Samples count: " + (samplesCount[0] == GL_TRUE)); return true; }
Example 9
Source File: Gl_430_multi_draw_indirect.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; float[] depth = {1.0f}; gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE * 3, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, windowSize.x / 3.0f / windowSize.y, 0.1f, 100.0f); Mat4 view = viewMat4(); pointer.position(Mat4.SIZE * 0); pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, +0.5f)).toFa_()); pointer.position(Mat4.SIZE * 1); pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, +0.0f)).toFa_()); pointer.position(Mat4.SIZE * 2); pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, -0.5f)).toFa_()); pointer.rewind(); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.A)); gl4.glActiveTexture(GL_TEXTURE1); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.B)); gl4.glActiveTexture(GL_TEXTURE2); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.C)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.INDIRECTION, bufferName.get(Buffer.VERTEX_INDIRECTION)); gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName.get(Buffer.INDIRECT)); validate(gl4); // LongBuffer buffer = GLBuffers.newDirectLongBuffer(1); for (int i = 0; i < indirectBufferCount; ++i) { gl4.glViewportIndexedfv(0, viewport[i].toFloatArray(), 0); // buffer.put(5 * Integer.BYTES * drawOffset[i]).rewind(); // buffer.asIntBuffer().put(0).rewind(); // buffer.rewind(); gl4.glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, null, drawCount[i], DrawElementsIndirectCommand.SIZE); } return true; }
Example 10
Source File: Gl_430_atomic_counter.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; // Setup blending gl4.glEnable(GL_BLEND); gl4.glBlendEquation(GL_FUNC_ADD); gl4.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); Mat4 mvp = projection.mul(viewMat4()).mul(model); mvp.toDbb(pointer); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } IntBuffer data = IntBuffer.wrap(new int[]{0}); gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufferName.get(Buffer.ATOMIC_COUNTER)); gl4.glClearBufferSubData(GL_ATOMIC_COUNTER_BUFFER, GL_R8UI, 0, Integer.BYTES, GL_RGBA, GL_UNSIGNED_INT, data); gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0.0f).put(1, 0.0f).put(2, 0.0f).put(3, 1.0f)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, bufferName.get(Buffer.ATOMIC_COUNTER)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 5, 0, 0); return true; }
Example 11
Source File: Gl_420_fbo.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); //glm::mat4 Projection = glm::perspectiveFov(glm::pi<float>() * 0.25f, 640.f, 480.f, 0.1f, 100.0f); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glEnable(GL_DEPTH_TEST); gl4.glDepthFunc(GL_LESS); gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0)); gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth.put(0, 1)); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 0.5f).put(2, 0).put(3, 1)); // Bind rendering objects gl4.glBindProgramPipeline(pipelineName.get(Pipeline.TEXTURE)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DIFFUSE)); gl4.glBindVertexArray(vertexArrayName.get(Pipeline.TEXTURE)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 2, 0, 0); gl4.glDisable(GL_DEPTH_TEST); gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0); gl4.glBindProgramPipeline(pipelineName.get(Pipeline.SPLASH)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindVertexArray(vertexArrayName.get(Pipeline.SPLASH)); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.COLORBUFFER)); gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0); return true; }
Example 12
Source File: Gl_440_query_occlusion.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } // Clear color buffer with black gl4.glClearBufferfv(GL_COLOR, 0, new float[]{0.0f, 0.0f, 0.0f, 1.0f}, 0); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindBufferBase(GL_SHADER_STORAGE_BUFFER, Semantic.Storage.VERTEX, bufferName.get(Buffer.VERTEX)); // Samples count query for (int i = 0; i < viewports.length; ++i) { gl4.glViewportArrayv(0, 1, viewports[i].toFA_(), 0); gl4.glBeginQuery(GL_ANY_SAMPLES_PASSED, queryName.get(i)); { gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1); } gl4.glEndQuery(GL_ANY_SAMPLES_PASSED); } gl4.glBindBuffer(GL_QUERY_BUFFER, bufferName.get(Buffer.QUERY)); IntBuffer params = GLBuffers.newDirectIntBuffer(1); for (int i = 0; i < viewports.length; ++i) { // params.put(0, Integer.BYTES * i); int[] a = {0}; gl4.glGetQueryObjectuiv(queryName.get(i), GL_QUERY_RESULT, a, 0); System.out.println("a: "+a[0]); } // ByteBuffer pointer = gl4.glMapBufferRange(GL_QUERY_BUFFER, 0, Integer.BYTES * queryName.capacity(), // GL_MAP_READ_BIT); // System.out.println("Samples count: " + pointer.get(0) + ", " + pointer.get(1) + ", " + pointer.get(2) // + ", " + pointer.get(3) + "\r"); // gl4.glUnmapBuffer(GL_QUERY_BUFFER); // gl4.glBindBuffer(GL_QUERY_BUFFER, 0); return true; }
Example 13
Source File: Gl_410_buffer_uniform_array.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; int uniformBufferOffset = Math.max(uniformBufferAlignment.get(0), Mat4.SIZE); int uniformBufferRange = uniformBufferOffset * 2; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, uniformBufferRange, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); Mat4 model0 = new Mat4(1.0f).translate(new Vec3(+1, 0, 0)); Mat4 model1 = new Mat4(1.0f).translate(new Vec3(-1, 0, 0)); pointer.position(uniformBufferOffset * 0); pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(model0).toFa_()); pointer.position(uniformBufferOffset * 1); pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(model1).toFa_()); pointer.rewind(); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); } gl4.glViewport(0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 1).put(2, 1).put(3, 1)); gl4.glUseProgram(programName); // Attach the buffer to UBO binding point semantic::uniform::MATERIAL gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL)); gl4.glBindVertexArray(vertexArrayName.get(0)); // Attach the buffer to UBO binding point semantic::uniform::TRANSFORM0 gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0, Mat4.SIZE); gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM1, bufferName.get(Buffer.TRANSFORM), uniformBufferOffset, Mat4.SIZE); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 1); return true; }
Example 14
Source File: Gl_500_multi_draw_indirect_count_arb.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; float[] depth = {1.0f}; gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName[Buffer.TRANSFORM]); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE * drawDataCount, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, windowSize.x / 3.0f / windowSize.y, 0.1f, 100.0f); Mat4 view = viewMat4(); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(view, new Mat4()).translate(0.0f, 0.0f, 0.5f).toFa_()); pointer.position(Mat4.SIZE * 1); pointer.asFloatBuffer().put(projection.mul(view, new Mat4()).translate(0.0f, 0.0f, 0.0f).toFa_()); pointer.position(Mat4.SIZE * 2); pointer.asFloatBuffer().put(projection.mul(view, new Mat4()).translate(0.0f, 0.0f, -0.5f).toFa_()); pointer.rewind(); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName[Texture.A]); gl4.glActiveTexture(GL_TEXTURE1); gl4.glBindTexture(GL_TEXTURE_2D, textureName[Texture.B]); gl4.glActiveTexture(GL_TEXTURE2); gl4.glBindTexture(GL_TEXTURE_2D, textureName[Texture.C]); gl4.glBindProgramPipeline(pipelineName[0]); gl4.glBindVertexArray(vertexArrayName[0]); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName[Buffer.TRANSFORM]); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.INDIRECTION, bufferName[Buffer.VERTEX_INDIRECTION]); gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName[Buffer.INDIRECT]); gl4.glBindBuffer(GL_PARAMETER_BUFFER_ARB, bufferName[Buffer.PARAMETER]); validate(gl4); for (int i = 0; i < drawDataCount; ++i) { gl4.glViewportIndexedfv(0, viewport[i].toFA_(), 0); gl4.glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, DrawElementsIndirectCommand.SIZE * drawOffset[i], // Offset in the indirect draw buffer drawCount[i], // Offset in the paramter buffer 4, DrawElementsIndirectCommand.SIZE); } return true; }
Example 15
Source File: Gl_420_sampler_fetch.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; Vec2i framebufferSize = windowSize.mul_(FRAMEBUFFER_SCALE); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, windowSize.x * 0.5f / windowSize.y, 0.1f, 1000.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model.scale(new Vec3(4.f))).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0)); gl4.glViewportIndexedf(0, 0, 0, framebufferSize.x, framebufferSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 0.5f).put(2, 0).put(3, 1)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DIFFUSE)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBindProgramPipeline(pipelineName.get(Program.PROG)); gl4.glViewportIndexedf(0, framebufferSize.x * 0.5f * 0.0f, 0, framebufferSize.x * 0.5f, framebufferSize.y); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); gl4.glBindProgramPipeline(pipelineName.get(Program.FUNC)); gl4.glViewportIndexedf(0, framebufferSize.x * 0.5f * 1.0f, 0, framebufferSize.x * 0.5f, framebufferSize.y); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); gl4.glBindFramebuffer(GL_READ_FRAMEBUFFER, framebufferName.get(0)); gl4.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); gl4.glBlitFramebuffer( 0, 0, framebufferSize.x, framebufferSize.y, 0, 0, windowSize.x, windowSize.y, GL_COLOR_BUFFER_BIT, GL_NEAREST); return true; }
Example 16
Source File: Gl_430_debug.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; gl4.glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, "Frame".getBytes(), 0); { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); projection.mul(viewMat4()).mul(model).toDbb(pointer); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Throwing an error on glClearBufferfv"); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 0.5f).put(2, 0.0f).put(3, 1.0f)); // Add an error for testing: GL_TEXTURE_2D instead of GL_COLOR // gl4.glClearBufferfv(GL_TEXTURE_2D, 0, clearColor.put(0, 1.0f).put(1, 0.5f).put(2, 0.0f).put(3, 1.0f)); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 1, GL_DEBUG_SEVERITY_NOTIFICATION, -1, "Throwing an error on glDrawElementsInstancedBaseVertexBaseInstance"); // Add an error for testing: GL_FLOAT instead of GL_UNSIGNED_SHORT // gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_FLOAT, 0, 1, 0, 0); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); gl4.glPopDebugGroup(); return true; }
Example 17
Source File: Gl_430_program_compute_image.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange( GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glBindProgramPipeline(pipelineName.get(Program.COMPUTE)); gl4.glBindImageTexture(Image.POSITION_INPUT, textureName.get(Texture.POSITION_INPUT), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); gl4.glBindImageTexture(Image.TEXCOORD_INPUT, textureName.get(Texture.TEXCOORD_INPUT), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); gl4.glBindImageTexture(Image.COLOR_INPUT, textureName.get(Texture.COLOR_INPUT), 0, false, 0, GL_READ_ONLY, GL_RGBA32F); gl4.glBindImageTexture(Image.POSITION_OUTPUT, textureName.get(Texture.POSITION_OUTPUT), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); gl4.glBindImageTexture(Image.TEXCOORD_OUTPUT, textureName.get(Texture.TEXCOORD_OUTPUT), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); gl4.glBindImageTexture(Image.COLOR_OUTPUT, textureName.get(Texture.COLOR_OUTPUT), 0, false, 0, GL_WRITE_ONLY, GL_RGBA32F); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDispatchCompute(vertexCount, 1, 1); gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0); gl4.glBindProgramPipeline(pipelineName.get(Program.GRAPHICS)); gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.DIFFUSE); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DIFFUSE)); gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.POSITION); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.POSITION_OUTPUT)); gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.TEXCOORD); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.TEXCOORD_OUTPUT)); gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.COLOR); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.COLOR_OUTPUT)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0); return true; }
Example 18
Source File: Gl_400_sampler_array.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; diffuseIndex++; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_()); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewport(0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 0.5f).put(2, 0).put(3, 1)); gl4.glUseProgram(programName); gl4.glUniform1ui(uniformDiffuseIndex, (diffuseIndex / 100) % 2); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(Texture.RGB)); gl4.glBindSampler(0, samplerName.get(0)); gl4.glActiveTexture(GL_TEXTURE1); gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(Texture.BGR)); gl4.glBindSampler(1, samplerName.get(0)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 2, 0); return true; }
Example 19
Source File: Gl_400_buffer_uniform_array.java From jogl-samples with MIT License | 4 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; int uniformBufferOffset = Math.max(uniformBufferAlignment.get(0), Mat4.SIZE); int uniformBufferRange = uniformBufferOffset * 2; { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, uniformBufferRange, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); Mat4 model0 = new Mat4(1.0f).translate(new Vec3(+1, 0, 0)); Mat4 model1 = new Mat4(1.0f).translate(new Vec3(-1, 0, 0)); pointer.position(uniformBufferOffset * 0); pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(model0).toFa_()); pointer.position(uniformBufferOffset * 1); pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(model1).toFa_()); // Make sure the uniform buffer is uploaded gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); } gl4.glViewport(0, 0, windowSize.x, windowSize.y); gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 1).put(2, 1).put(3, 1)); gl4.glUseProgram(programName); // Attach the buffer to UBO binding point semantic::uniform::TRANSFORM0 gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0, Mat4.SIZE); gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM1, bufferName.get(Buffer.TRANSFORM), uniformBufferOffset, Mat4.SIZE); // Attach the buffer to UBO binding point semantic::uniform::MATERIAL gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 2, 0); return true; }
Example 20
Source File: Gl_500_primitive_bindless_nv.java From jogl-samples with MIT License | 2 votes |
@Override protected boolean render(GL gl) { GL4 gl4 = (GL4) gl; /*// Measure speed double currentTime = glfwGetTime(); nbFrames++; if (currentTime - lastTime >= 1.0) { // If last prinf() was more than 1 sec ago // printf and reset timer printf("%f ms/frame\n", 1000.0 / double(nbFrames)); nbFrames = 0; lastTime += 1.0; }*/ { Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f); Mat4 model = new Mat4(1.0f); Mat4 mvp = projection.mul(viewMat4()).mul(model); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT); pointer.asFloatBuffer().put(mvp.toFa_()); gl4.glUnmapBuffer(GL_UNIFORM_BUFFER); } gl4.glViewportIndexedfv(0, new float[]{0, 0, windowSize.x, windowSize.y}, 0); gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 0.5f, 0.0f, 1.0f}, 0); gl4.glBindProgramPipeline(pipelineName.get(0)); gl4.glBindTextureUnit(0, textureName.get(0)); gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM)); gl4.glBindVertexArray(vertexArrayName.get(0)); gl4.glBufferAddressRangeNV(GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV, Semantic.Attr.POSITION, address.get(0), vertexSize); gl4.glBufferAddressRangeNV(GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV, Semantic.Attr.TEXCOORD, address.get(0) + Vec2.SIZE, vertexSize - Vec2.SIZE); gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, vertexCount, 1, 0); return true; }