diff --git a/RecrownedGTK/Graphics/ElementBufferArrayHandle.cs b/RecrownedGTK/Graphics/ElementBufferArrayHandle.cs index c0c07fc..e772a7f 100644 --- a/RecrownedGTK/Graphics/ElementBufferArrayHandle.cs +++ b/RecrownedGTK/Graphics/ElementBufferArrayHandle.cs @@ -7,15 +7,12 @@ namespace RecrownedGTK.Graphics { public ElementBufferArrayHandle() { handle = GL.GenBuffer(); } + public void Bind() { GL.BindBuffer(BufferTarget.ElementArrayBuffer, handle); } - - public void Unbind() { - GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); - } - - public void Flush(uint[] indices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { + public void Buffer(uint[] indices, BufferUsageHint hint = BufferUsageHint.DynamicDraw) { + Bind(); GL.BufferData(BufferTarget.ElementArrayBuffer, indices.Length * sizeof(uint), indices, hint); } @@ -30,7 +27,7 @@ namespace RecrownedGTK.Graphics { } disposed = true; - Unbind(); + GL.DeleteBuffer(handle); } diff --git a/RecrownedGTK/Graphics/VertexBufferArrayHandle.cs b/RecrownedGTK/Graphics/VertexBufferArrayHandle.cs index aa32086..9a90b7c 100644 --- a/RecrownedGTK/Graphics/VertexBufferArrayHandle.cs +++ b/RecrownedGTK/Graphics/VertexBufferArrayHandle.cs @@ -10,7 +10,8 @@ namespace RecrownedGTK.Graphics { public void Bind() { GL.BindBuffer(BufferTarget.ArrayBuffer, handle); } - public void Flush(float[] vertices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { + public void Buffer(float[] vertices, BufferUsageHint hint = BufferUsageHint.DynamicCopy) { + Bind(); GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, hint); } public void Dispose() {