public void Render() { #if (DEBUG) if (ProjectionMatrix == null) { Logger.Log("No projection matrix is set!", Severity.Warning); } #endif Shader.Use(); Shader.SetProjectionMatrix(ProjectionMatrix); VAO.Bind(); if (IsDirty()) { BuildMesh(); } for (int i = 0; i < Textures.Count; i++) { if (Textures[i] != null) { Textures[i].Bind(i); } } if (Atlas != null) { Shader.SetUniform("atlasSize", Atlas.GetWidth(), Atlas.GetHeight()); } for (int i = 0; i < Math.Min(VBOs.Count, EBOs.Count); i++) { if (VBOs[i].GetSize() == 0 || EBOs[i].GetSize() == 0) { return; } VAO.Clear(); GL.DrawElements(PrimitiveType.Triangles, EBOs[i].GetSize(), DrawElementsType.UnsignedInt, 0); } }