private boolean initProgram(GL4 gl4) {

    boolean validated = true;

    try {

      if (validated) {

        String[] vertexSourceContent =
            new String[] {
              new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE + ".vert"))
                  .useDelimiter("\\A")
                  .next()
            };
        programName[Program.VERT.ordinal()] =
            gl4.glCreateShaderProgramv(GL_VERTEX_SHADER, 1, vertexSourceContent);
      }

      if (validated) {

        String[] fragmentSourceContent =
            new String[] {
              new Scanner(new File(SHADERS_ROOT + "/" + SHADERS_SOURCE + ".frag"))
                  .useDelimiter("\\A")
                  .next()
            };
        programName[Program.FRAG.ordinal()] =
            gl4.glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, fragmentSourceContent);
      }

      if (validated) {

        validated = validated && checkProgram(gl4, programName[Program.VERT.ordinal()]);
        validated = validated && checkProgram(gl4, programName[Program.FRAG.ordinal()]);
      }

      if (validated) {

        uniformMvp = gl4.glGetUniformLocation(programName[Program.VERT.ordinal()], "mvp");
        uniformDiffuse = gl4.glGetUniformLocation(programName[Program.FRAG.ordinal()], "diffuse");
      }

      if (validated) {

        gl4.glGenProgramPipelines(1, pipelineName, 0);
        gl4.glBindProgramPipeline(pipelineName[0]);
        gl4.glUseProgramStages(
            pipelineName[0], GL_VERTEX_SHADER_BIT, programName[Program.VERT.ordinal()]);
        gl4.glUseProgramStages(
            pipelineName[0], GL_FRAGMENT_SHADER_BIT, programName[Program.FRAG.ordinal()]);
      }

    } catch (FileNotFoundException ex) {
      Logger.getLogger(Gl_410_program_64.class.getName()).log(Level.SEVERE, null, ex);
    }

    return validated && checkError(gl4, "initProgram");
  }
  @Override
  protected boolean end(GL gl) {

    GL4 gl4 = (GL4) gl;

    gl4.glDeleteBuffers(Buffer.MAX.ordinal(), bufferName, 0);
    gl4.glDeleteVertexArrays(1, vertexArrayName, 0);
    gl4.glDeleteProgram(programName[Program.VERT.ordinal()]);
    gl4.glDeleteProgram(programName[Program.FRAG.ordinal()]);
    gl4.glBindProgramPipeline(0);
    gl4.glDeleteProgramPipelines(1, pipelineName, 0);

    return true;
  }
  @Override
  protected boolean render(GL gl) {

    GL4 gl4 = (GL4) gl;

    FloatUtil.makePerspective(
        projection,
        0,
        true,
        (float) Math.PI * 0.25f,
        (float) windowSize.x / windowSize.y,
        0.1f,
        100.0f);
    view = view();
    FloatUtil.makeIdentity(model);
    FloatUtil.multMatrix(projection, view);
    FloatUtil.multMatrix(projection, model);

    for (int i = 0; i < projection.length; i++) {
      mvp[i] = projection[i];
    }

    gl4.glProgramUniformMatrix4dv(
        programName[Program.VERT.ordinal()], uniformMvp, 1, false, mvp, 0);
    gl4.glProgramUniform4dv(
        programName[Program.FRAG.ordinal()],
        uniformDiffuse,
        1,
        new double[] {1.0f, 0.5f, 0.0f, 1.0f},
        0);

    gl4.glViewportIndexedfv(0, new float[] {0, 0, windowSize.x, windowSize.y}, 0);
    gl4.glClearBufferfv(GL_COLOR, 0, new float[] {0.0f, 0.0f, 0.0f, 0.0f}, 0);

    gl4.glBindProgramPipeline(pipelineName[0]);

    gl4.glBindVertexArray(vertexArrayName[0]);
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName[Buffer.ELEMENT.ordinal()]);
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);

    return true;
  }
  @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.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, new float[] {1.0f, 0.5f, 0.0f, 1.0f}, 0);

    gl4.glBindProgramPipeline(pipelineName.get(0));
    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
    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;
  }