Exemple #1
0
  @Override
  public void dispose(GLAutoDrawable glad) {
    GL3 gl3 = glad.getGL().getGL3();

    gl3.glDeleteVertexArrays(1, VAO, 0);
    gl3.glDeleteBuffers(1, VBO, 0);
    for (int shader : shaders) gl3.glDeleteShader(shader);
    gl3.glDeleteProgram(program);
  }
  @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
  protected boolean end(GL gl) {

    GL3 gl3 = (GL3) gl;

    gl3.glDeleteBuffers(1, bufferName);
    gl3.glDeleteProgram(programName);
    gl3.glDeleteTextures(1, textureName);
    gl3.glDeleteVertexArrays(1, vertexArrayName);

    BufferUtils.destroyDirectBuffer(bufferName);
    BufferUtils.destroyDirectBuffer(textureName);
    BufferUtils.destroyDirectBuffer(vertexArrayName);

    return checkError(gl3, "end");
  }
  @Override
  protected boolean end(GL gl) {

    GL3 gl3 = (GL3) gl;

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

    BufferUtils.destroyDirectBuffer(bufferName);
    BufferUtils.destroyDirectBuffer(textureName);
    BufferUtils.destroyDirectBuffer(vertexArrayName);

    BufferUtils.destroyDirectBuffer(clearColor);

    return true;
  }