public override void Render(Matrix4 viewMatrix, Matrix4 projectionMatrix, List <Light> lights, bool PhongLightningModel, bool PhongShading) { if (RawModel != null) { int offset = 0; renderer.Use(); renderer.SetModelMatrix(ModelMatrix); renderer.SetProjectionMatrix(projectionMatrix); renderer.SetViewMatrix(viewMatrix); renderer.SetHasTexture(Texture != null); renderer.SetPhongLightning(PhongLightningModel); renderer.SetDiscard(true); GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, Texture.TextureId); renderer.EnableVertexAttribArrays(); foreach (Mesh mesh in RawModel.Meshes) { renderer.SetAmbientColor(mesh.MeshMaterial.Ka); renderer.SetDiffuseColor(mesh.MeshMaterial.Kd); renderer.SetSpecularColor(mesh.MeshMaterial.Ks); renderer.SetSpecularExponent(mesh.MeshMaterial.Ns); GL.DrawElements(BeginMode.Triangles, mesh.Indices.Count, DrawElementsType.UnsignedInt, offset * sizeof(uint)); offset += mesh.Indices.Count; } renderer.DisableVertexAttribArrays(); } }