/// <summary> /// This is the main function of the class, it'll create a triangulated polygon /// from and SceneObject. /// </summary> /// <param name="sourceObject">The object to convert.</param> /// <param name="guarenteedView">A camera that can see the whole object.</param> /// <returns>A polygon created from 'sourceObject'.</returns> public Polygon CreatePolygon(OpenGL gl, SceneObject sourceObject, Cameras.Camera guarenteedView) { // Save the current camera data. gl.MatrixMode(OpenGL.PROJECTION); gl.PushMatrix(); // Look through the camera that can see the object. guarenteedView.Project(gl); // Start triangulation. Begin(gl); // Draw the object. sourceObject.Draw(gl); // End triangulation. End(gl); Polygon newPoly = Triangle; newPoly.Name = sourceObject.Name + " (Triangulated Poly)"; return newPoly; }