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 { |     public class VertexBufferHandle : IDisposable { | ||||||
|         private bool disposed; |         private bool disposed; | ||||||
|         private int handle; |         private int handle; | ||||||
|         public bool Bound { |  | ||||||
|             get; |  | ||||||
|             private set; |  | ||||||
|         } |  | ||||||
|         public VertexBufferHandle() { |         public VertexBufferHandle() { | ||||||
|             handle = GL.GenBuffer(); |             handle = GL.GenBuffer(); | ||||||
|         } |         } | ||||||
|         public void Bind() { |         public void Bind() { | ||||||
|             Bound = true; |  | ||||||
|             GL.BindBuffer(BufferTarget.ArrayBuffer, handle); |             GL.BindBuffer(BufferTarget.ArrayBuffer, handle); | ||||||
|         } |         } | ||||||
|         public void Unbind() { |         public void Unbind() { | ||||||
|             Bound = false; |  | ||||||
|             GL.BindBuffer(BufferTarget.ArrayBuffer, 0); |             GL.BindBuffer(BufferTarget.ArrayBuffer, 0); | ||||||
|         } |         } | ||||||
|         public void Buffer(float[] vertices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { |         public void Flush(float[] vertices, BufferUsageHint hint = BufferUsageHint.StaticDraw) { | ||||||
|             if (Bound) { |             GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, hint); | ||||||
|                 GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, hint); |  | ||||||
|                 return; |  | ||||||
|             }  |  | ||||||
|             throw new InvalidOperationException("Buffer is not bound."); |  | ||||||
|         } |         } | ||||||
|         public void Dispose() { |         public void Dispose() { | ||||||
|             Dispose(true); |             Dispose(true); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user