Removed state tracking for VertexBufferHandle due to potential overlapping states.
This commit is contained in:
		| @@ -4,27 +4,18 @@ namespace RecrownedGTK.Graphics { | ||||
|     public class VertexBufferHandle : IDisposable { | ||||
|         private bool disposed; | ||||
|         private int handle; | ||||
|         public bool Bound { | ||||
|             get; | ||||
|             private set; | ||||
|         } | ||||
|         public VertexBufferHandle() { | ||||
|             handle = GL.GenBuffer(); | ||||
|         } | ||||
|         public void Bind() { | ||||
|             Bound = true; | ||||
|             GL.BindBuffer(BufferTarget.ArrayBuffer, handle); | ||||
|         } | ||||
|         public void Unbind() { | ||||
|             Bound = false; | ||||
|  | ||||
|             GL.BindBuffer(BufferTarget.ArrayBuffer, 0); | ||||
|         } | ||||
|         public void Buffer(float[] vertices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { | ||||
|             if (Bound) { | ||||
|                 GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, hint); | ||||
|                 return; | ||||
|             }  | ||||
|             throw new InvalidOperationException("Buffer is not bound."); | ||||
|         public void Flush(float[] vertices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { | ||||
|             GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, hint); | ||||
|         } | ||||
|         public void Dispose() { | ||||
|             Dispose(true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user