public static void RenderModelMesh(ModelMesh mesh, Matrix4 matrix, int offset, int count, Color4 color) { SetColor(color); Texture.BindNone(); Lighting.EnableLighting(); if (_currentVao != mesh.GetVaoID()) { mesh.BindVAO(); _currentVao = mesh.GetVaoID(); } int uModelLocation = _currentShader.GetUniformLocation("uModel"); GL.UniformMatrix4(uModelLocation, true, ref matrix); if (_worldMatrixChanged) { int uWorldLocation = _currentShader.GetUniformLocation("uWorld"); Matrix4 worldMatrix = _worldMatrixStack.Count > 0 ? (Matrix4)_worldMatrixStack.Peek() : _worldMatrix; GL.UniformMatrix4(uWorldLocation, true, ref worldMatrix); Lighting.ApplyLightMatrix(worldMatrix); } GL.DrawElements(PrimitiveType.Triangles, count, DrawElementsType.UnsignedInt, offset * sizeof(uint)); Lighting.DisableLighting(); }