diff --git a/src/SlatedGameToolkit.Framework/Graphics/Render/MeshBatchRenderer.cs b/src/SlatedGameToolkit.Framework/Graphics/Render/MeshBatchRenderer.cs index 355ae3b..0033a79 100644 --- a/src/SlatedGameToolkit.Framework/Graphics/Render/MeshBatchRenderer.cs +++ b/src/SlatedGameToolkit.Framework/Graphics/Render/MeshBatchRenderer.cs @@ -136,6 +136,7 @@ namespace SlatedGameToolkit.Framework.Graphics.Render /// /// Draws the given mesh. public virtual void Draw(IMesh mesh) { + if (!Batching) throw new InvalidOperationException("This batch has not been begun."); IPositionInterpolable moveable = mesh as IPositionInterpolable; if (moveable != null) { moveable.InterpolatePosition(batchDelta); @@ -188,11 +189,12 @@ namespace SlatedGameToolkit.Framework.Graphics.Render public virtual void End() { if (!Batching) throw new InvalidOperationException("This batch was never started."); - this.Batching = false; Flush(); + this.Batching = false; } public virtual void Flush() { + if (!Batching) throw new InvalidOperationException("This batch has not been begun."); if (offsetIndex == 0) return; if (texture != null) { GLContext.BindTexture(TextureTarget.Texture2D, texture.Handle);