/// <summary> /// Render to the provided instance of OpenGL. /// </summary> /// <param name="gl">The OpenGL instance.</param> /// <param name="renderMode">The render mode.</param> public override void Render(OpenGL gl, Core.RenderMode renderMode) { base.Render(gl, renderMode); // Begin drawing a NURBS surface. gl.BeginSurface(nurbsRenderer); // Draw the surface. gl.NurbsSurface(nurbsRenderer, // The internal nurbs object. sKnots.Length, // Number of s-knots. sKnots, // The s-knots themselves. tKnots.Length, // The number of t-knots. tKnots, // The t-knots themselves. ControlPoints.Width * 3, // The size of a row of control points. 3, // The size of a control points. ControlPoints.ToFloatArray(), // The control points. ControlPoints.Width, // The order, i.e degree + 1. ControlPoints.Height, // The order, i.e degree + 1. OpenGL.GL_MAP2_VERTEX_3); // Type of data to generate. // End the surface. gl.EndSurface(nurbsRenderer); // Draw the control points. ControlPoints.Draw(gl, DrawControlPoints, DrawControlGrid); }
public override void Draw(OpenGL gl) { // Do pre drawing stuff. if (DoPreDraw(gl)) { base.Draw(gl); // Set our line settings. lineSettings.Set(gl); // Begin drawing a NURBS surface. gl.BeginSurface(nurbsRenderer); // Draw the surface. gl.NurbsSurface(nurbsRenderer, // The internal nurbs object. sKnots.Length, // Number of s-knots. sKnots, // The s-knots themselves. tKnots.Length, // The number of t-knots. tKnots, // The t-knots themselves. controlPoints.Width * 3, // The size of a row of control points. 3, // The size of a control points. controlPoints.ToFloatArray(), // The control points. controlPoints.Width, // The order, i.e degree + 1. controlPoints.Height, // The order, i.e degree + 1. OpenGL.MAP2_VERTEX_3); // Type of data to generate. // End the surface. gl.EndSurface(nurbsRenderer); // Draw the control points. controlPoints.Draw(gl, drawPoints, drawLines); // Restore the line attributes. lineSettings.Restore(gl); // Do post drawing stuff. DoPostDraw(gl); } }