@Override public void release(DrawContext dc) { this.deleteBufferObject(dc); this.buffer = null; // buffer can be non-null if the object has not been bound }
protected void loadBuffer(DrawContext dc) { int currentBuffer = dc.currentBuffer(this.bufferTarget); try { // Create the OpenGL buffer object. if (this.bufferId[0] == 0) { this.createBufferObject(dc); } // Make the OpenGL buffer object bound to the specified target. dc.bindBuffer(this.bufferTarget, this.bufferId[0]); // Load the current NIO buffer as the OpenGL buffer object's data. this.loadBufferObjectData(dc); } catch (Exception e) { // The NIO buffer could not be used as buffer data for an OpenGL buffer object. Delete the buffer object // to ensure that calls to bindBuffer fail. this.deleteBufferObject(dc); Logger.logMessage(Logger.ERROR, "BufferObject", "loadBuffer", "Exception attempting to load buffer data", e); } finally { // Restore the current OpenGL buffer object binding. dc.bindBuffer(this.bufferTarget, currentBuffer); } }