Exemplo n.º 1
0
        /// <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);
        }