recrownedgtk/RecrownedGTK/Graphics/ElementBufferArrayHandle.cs
Harrison 04f9aab10b Added documentation.
Added more documentation.

Corrected doc.
2020-04-04 18:24:25 -05:00

39 lines
1.0 KiB
C#

using System;
using OpenTK.Graphics.OpenGL;
namespace RecrownedGTK.Graphics {
public class ElementBufferArrayHandle : IDisposable {
private bool disposed;
private int handle;
public ElementBufferArrayHandle() {
handle = GL.GenBuffer();
}
public void Bind() {
GL.BindBuffer(BufferTarget.ElementArrayBuffer, handle);
}
public void Buffer(uint[] indices, BufferUsageHint hint = BufferUsageHint.DynamicDraw) {
Bind();
GL.BufferData(BufferTarget.ElementArrayBuffer, indices.Length * sizeof(uint), indices, hint);
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
if (disposed) return;
if (disposing) {
}
disposed = true;
GL.DeleteBuffer(handle);
}
~ElementBufferArrayHandle() {
Dispose(false);
}
}
}