Java Code Examples for com.jogamp.opengl.GL4#glBindBufferRange()

The following examples show how to use com.jogamp.opengl.GL4#glBindBufferRange() . 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_430_direct_state_access_ext.java    From jogl-samples with MIT License 6 votes vote down vote up
private void renderFBO(GL4 gl4) {
    //glEnable(GL_SAMPLE_MASK);
    //glSampleMaski(0, 0xFF);

    gl4.glEnable(GL_MULTISAMPLE);
    gl4.glEnable(GL_SAMPLE_SHADING);
    gl4.glMinSampleShading(4 / 4.0f);

    gl4.glViewportIndexedf(0, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f));

    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
            uniformBlockSize);
    gl4.glBindSampler(0, samplerName.get(0));
    gl4.glBindTextureUnit(0, textureName.get(Texture.TEXTURE));
    gl4.glBindVertexArray(vertexArrayName.get(0));

    gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);

    gl4.glDisable(GL_MULTISAMPLE);
}
 
Example 2
Source File: Gl_450_direct_state_access.java    From jogl-samples with MIT License 6 votes vote down vote up
private void renderFBO(GL4 gl4) {

        gl4.glEnable(GL_MULTISAMPLE);
        gl4.glEnable(GL_SAMPLE_SHADING);
        gl4.glMinSampleShading(4 / 4.0f);

        gl4.glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
        gl4.glViewportIndexedf(0, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);

        gl4.glClearNamedFramebufferfv(framebufferName.get(Framebuffer.RENDER), GL_COLOR, 0, clearColor);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
                uniformBlockSize);
        gl4.glBindSamplers(0, 1, samplerName);
        gl4.glBindTextureUnit(0, textureName.get(Texture.TEXTURE));
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);

        gl4.glDisable(GL_MULTISAMPLE);
    }
 
Example 3
Source File: Gl_450_fbo_multisample_explicit.java    From jogl-samples with MIT License 6 votes vote down vote up
private void renderFBO(GL4 gl4, int framebuffer) {

        gl4.glEnable(GL_DEPTH_TEST);

        gl4.glBindProgramPipeline(pipelineName.get(Program.THROUGH));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
                uniformBlockSize);

        gl4.glViewport(0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
        float[] depth = {1.0f};
        gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0);
        gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 0.5f, 0.0f, 1.0f}, 0);

        textureName.position(Texture.DIFFUSE);
        gl4.glBindTextures(0, 1, textureName);
        textureName.rewind();
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 5);

        gl4.glDisable(GL_DEPTH_TEST);
    }
 
Example 4
Source File: Gl_500_direct_state_access_gtc.java    From jogl-samples with MIT License 6 votes vote down vote up
private void renderFBO(GL4 gl4) {

        gl4.glEnable(GL_MULTISAMPLE);
        gl4.glEnable(GL_SAMPLE_SHADING);
        gl4.glMinSampleShading(4.0f);

        gl4.glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
        gl4.glViewportIndexedf(0, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);
        FloatBuffer clear = GLBuffers.newDirectFloatBuffer(new float[]{0.0f, 0.5f, 1.0f, 1.0f});
        gl4.glClearNamedFramebufferfv(framebufferName.get(Framebuffer.RENDER), GL_COLOR, 0, clear);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
                uniformBlockSize);
        gl4.glBindSamplers(0, 1, samplerName);
        gl4.glBindTextureUnit(0, textureName.get(Texture.TEXTURE));
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);

        gl4.glDisable(GL_MULTISAMPLE);
    }
 
Example 5
Source File: Gl_450_direct_state_access.java    From jogl-samples with MIT License 5 votes vote down vote up
@Override
protected boolean render(GL gl) {

    GL4 gl4 = (GL4) gl;

    {
        Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y,
                0.1f, 100.0f);
        viewMat4().print("view");
        uniformPointer.asFloatBuffer().put(viewMat4().toFa_());
        //uniformPointer.asFloatBuffer().put(new Mat4().toFa_());
    }

    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    
    gl4.glUseProgram(programName);


    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);        
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor);
    
    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, 
            Semantic.Uniform.TRANSFORM0, 
            bufferName.get(Buffer.TRANSFORM), 
            0,
            Mat4.SIZE);
    
    gl4.glBindVertexArray(vertexArrayName.get(0));

    gl4.glDrawArrays(GL_TRIANGLES, 0, 3);

    return true;
}
 
Example 6
Source File: Gl_450_direct_state_access.java    From jogl-samples with MIT License 5 votes vote down vote up
private void renderFB(GL4 gl4) {

        gl4.glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
        gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
        gl4.glClearNamedFramebufferfv(0, GL_COLOR, 0, new float[]{0.0f, 0.5f, 1.0f, 1.0f}, 0);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM),
                uniformBlockSize, uniformBlockSize);
        gl4.glBindTextureUnit(0, textureName.get(Texture.COLORBUFFER));
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
    }
 
Example 7
Source File: Gl_450_fbo_multisample_explicit.java    From jogl-samples with MIT License 5 votes vote down vote up
private void resolveMultisampling(GL4 gl4) {

        gl4.glViewport(0, 0, windowSize.x, windowSize.y);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

        textureName.position(Texture.MULTISAMPLE_COLORBUFFER);
        gl4.glBindTextures(0, 1, textureName);
        textureName.rewind();
        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM),
                uniformBlockSize, uniformBlockSize);

        gl4.glEnable(GL_SCISSOR_TEST);

        // Box
        {
            gl4.glScissor(1, 1, windowSize.x / 2 - 2, windowSize.y - 2);

            gl4.glBindProgramPipeline(pipelineName.get(Program.RESOLVE_BOX));
            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 5);
        }

        // Near
        {
            gl4.glScissor(windowSize.x / 2 + 1, 1, windowSize.x / 2 - 2, windowSize.y - 2);

            gl4.glBindProgramPipeline(pipelineName.get(Program.RESOLVE_NEAR));
            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 5);
        }

        gl4.glDisable(GL_SCISSOR_TEST);
    }
 
Example 8
Source File: Gl_500_direct_state_access_gtc.java    From jogl-samples with MIT License 5 votes vote down vote up
private void renderFB(GL4 gl4) {

        gl4.glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
        gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
        FloatBuffer clear = GLBuffers.newDirectFloatBuffer(new float[]{0.0f, 0.5f, 1.0f, 1.0f});
        gl4.glClearNamedFramebufferfv(0, GL_COLOR, 0, clear);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM),
                uniformBlockSize, uniformBlockSize);
        gl4.glBindTextureUnit(0, textureName.get(Texture.COLORBUFFER));
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
    }
 
Example 9
Source File: Gl_430_query_conditional.java    From jogl-samples with MIT License 4 votes vote down vote up
@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);
        gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));

        // 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.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL), 0, Vec4.SIZE);

        // The first orange quad is not written in the framebuffer.
//        gl4.glColorMaski(0, false, false, false, false);

        // Beginning of the samples count query
        gl4.glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, queryName.get(0));
        {
            if (toggle) {
                // To test the condional rendering, comment this line, the next draw call won't happen.
                gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
            }
        }// End of the samples count query
        gl4.glEndQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE);

        // The second blue quad is written in the framebuffer only if a sample pass the occlusion query.
        gl4.glColorMaski(0, true, true, true, true);

        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL),
                uniformMaterialOffset, Vec4.SIZE);

        // Draw only if one sample went through the tests, 
        // we don't need to get the query result which prevent the rendering pipeline to stall.
        gl4.glBeginConditionalRender(queryName.get(0), GL_QUERY_WAIT);
        {
            // Clear color buffer with white
            gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0);

//            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
        }
        gl4.glEndConditionalRender();

        toggle = !toggle;

        return true;
    }
 
Example 10
Source File: Gl_450_query_conditional.java    From jogl-samples with MIT License 4 votes vote down vote up
@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, uniformTransformOffset * 2, 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, 10.0f);
        /**
         * A translation of Vec3(0.0f, 0.0f, 0.0f) pushes the square outside the screen, it makes no sense.
         */
        Mat4 model0 = new Mat4(1.0f).translate(new Vec3(0.0f, 0.0f, 0.0f));
        Mat4 model1 = new Mat4(1.0f);

        pointer.position(uniformTransformOffset * 0);
        pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(model0).toFa_());
        pointer.position(uniformTransformOffset * 1);
        pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model1).toFa_());
        pointer.rewind();

        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, blackColor);

    gl4.glBindProgramPipeline(pipelineName.get(0));
    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL), 0,
            Vec4.SIZE);
    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
            Mat4.SIZE);

    // The first orange quad is not written in the framebuffer.
    gl4.glColorMaski(0, false, false, false, false);

    // Beginning of the samples count query
    gl4.glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, queryName.get(0));
    {
        if (toggle) {
            // To test the condional rendering, comment this line, the next draw call won't happen.
            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
            // End of the samples count query
        }
    }
    gl4.glEndQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE);

    // The second blue quad is written in the framebuffer only if a sample pass the occlusion query.
    gl4.glColorMaski(0, true, true, true, true);

    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM),
            uniformTransformOffset, Mat4.SIZE);

    // Draw only if one sample went through the tests, 
    // we don't need to get the query result which prevent the rendering pipeline to stall.
    gl4.glBeginConditionalRender(queryName.get(0), GL_QUERY_WAIT);
    {	// Clear color buffer with white
        gl4.glClearBufferfv(GL_COLOR, 0, whiteColor);

        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL), 0,
                Vec4.SIZE);
        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    }
    gl4.glEndConditionalRender();

    gl4.glBeginConditionalRender(queryName.get(0), GL_QUERY_WAIT_INVERTED);
    {	// Clear color buffer with black
        gl4.glClearBufferfv(GL_COLOR, 0, blackColor);

        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL),
                uniformMaterialOffset, Vec4.SIZE);
        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    }
    gl4.glEndConditionalRender();

    toggle = !toggle;

    return true;
}
 
Example 11
Source File: Gl_400_buffer_uniform_array.java    From jogl-samples with MIT License 4 votes vote down vote up
@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 12
Source File: Gl_410_buffer_uniform_array.java    From jogl-samples with MIT License 4 votes vote down vote up
@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;
}