@Override
  public void dispose(GLAutoDrawable drawable) {
    System.out.println("dispose");

    GL3 gl3 = drawable.getGL().getGL3();

    gl3.glDeleteProgram(programName);
    gl3.glDeleteVertexArrays(1, vertexArrayName);
    gl3.glDeleteBuffers(Buffer.MAX, bufferName);

    System.exit(0);
  }
  @Override
  public void init(GLAutoDrawable drawable) {
    System.out.println("init");

    GL3 gl3 = drawable.getGL().getGL3();

    initBuffers(gl3);

    initVertexArray(gl3);

    initProgram(gl3);

    gl3.glEnable(GL_DEPTH_TEST);

    start = System.currentTimeMillis();
  }
  @Override
  public void display(GLAutoDrawable drawable) {
    //        System.out.println("display");

    GL3 gl3 = drawable.getGL().getGL3();

    /**
     * We set the clear color and depth (although depth is not necessary since it is 1 by default).
     */
    gl3.glClearColor(0f, .33f, 0.66f, 1f);
    gl3.glClearDepthf(1f);
    gl3.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    {
      // update matrix based on time
      now = System.currentTimeMillis();
      float diff = (float) (now - start) / 1000;
      /**
       * Here we build the matrix that will multiply our original vertex positions. We scale,
       * halving it, and rotate it.
       */
      scale = FloatUtil.makeScale(scale, true, 0.5f, 0.5f, 0.5f);
      zRotazion = FloatUtil.makeRotationEuler(zRotazion, 0, 0, 0, diff);
      modelToClip = FloatUtil.multMatrix(scale, zRotazion);
    }
    gl3.glUseProgram(programName);
    gl3.glBindVertexArray(vertexArrayName.get(0));

    gl3.glUniformMatrix4fv(modelToClipMatrixUL, 1, false, modelToClip, 0);

    gl3.glDrawElements(GL_TRIANGLES, elementSize, GL_UNSIGNED_SHORT, 0);
    /**
     * The following line binds VAO and program to the default values, this is not a cheaper
     * binding, it costs always as a binding. Every binding means additional validation and
     * overhead, this may affect your performances. So you should avoid these calls, but remember
     * that OpenGL is a state machine, so what you left bound remains bound!
     */
    //        gl3.glBindVertexArray(0);
    //        gl3.glUseProgram(0);
    /**
     * Check always any GL error, but keep in mind this is an implicit synchronization between CPU
     * and GPU, so you should use it only for debug purposes.
     */
    checkError(gl3, "display");
  }