/// <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); }
/// <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, RenderMode renderMode) { // Create the evaluator. gl.Map1(OpenGL.GL_MAP1_VERTEX_3, // Use and produce 3D points. 0, // Low order value of 'u'. 1, // High order value of 'u'. 3, // Size (bytes) of a control point. ControlPoints.Width, // Order (i.e degree plus one). ControlPoints.ToFloatArray()); // The control points. // Enable the type of evaluator we wish to use. gl.Enable(OpenGL.GL_MAP1_VERTEX_3); // Beging drawing a line strip. gl.Begin(OpenGL.GL_LINE_STRIP); // Now draw it. for (int i = 0; i <= segments; i++) { gl.EvalCoord1((float)i / segments); } gl.End(); // Draw the control points. ControlPoints.Draw(gl, DrawControlPoints, DrawControlGrid); }
/// <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) { // Call the base. base.Render(gl, renderMode); // Begin drawing a NURBS curve. gl.BeginCurve(nurbsRenderer); // Draw the curve. gl.NurbsCurve(nurbsRenderer, // The internal nurbs object. knots.Length, // Number of knots. knots, // The knots themselves. 3, // The size of a vertex. ControlPoints.ToFloatArray(), // The control points. ControlPoints.Width, // The order, i.e degree + 1. OpenGL.GL_MAP1_VERTEX_3); // Type of data to generate. // End the curve. gl.EndCurve(nurbsRenderer); // Draw the control points. ControlPoints.Draw(gl, DrawControlPoints, DrawControlGrid); }
/// <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, RenderMode renderMode) { // Create the evaluator. gl.Map2(OpenGL.GL_MAP2_VERTEX_3, // Use and produce 3D points. 0, // Low order value of 'u'. 1, // High order value of 'u'. 3, // Size (bytes) of a control point. ControlPoints.Width, // Order (i.e degree plus one). 0, // Low order value of 'v'. 1, // High order value of 'v' ControlPoints.Width * 3, // Size in bytes of a 'row' of points. ControlPoints.Height, // Order (i.e degree plus one). ControlPoints.ToFloatArray()); // The control points. gl.Enable(OpenGL.GL_MAP2_VERTEX_3); gl.Enable(OpenGL.GL_AUTO_NORMAL); gl.MapGrid2(20, 0, 1, 20, 0, 1); // Now draw it. gl.EvalMesh2(OpenGL.GL_FILL, 0, 20, 0, 20); // Draw the control points. ControlPoints.Draw(gl, DrawControlPoints, DrawControlGrid); }