(gfx:map-1 opengl target u1 u2 stride order points)


Evaluators provide a way to use polynomial or rational polynomial mapping  to  produce vertices, normals, texture coordinates, and colors.  The values produced by an evaluator are sent to further stages of GL processing just as if they had been presented  using glVertex, glNormal, glTexCoord, and glColor commands, except that the generated values do not update the current normal, texture coordinates, or color.  All polynomial or rational polynomial splines of any  degree  (up  to  the  maximum       degree  supported  by  the  GL  implementation)  can be described using evaluators.       These include almost all splines  used  in  computer  graphics:  B-splines,  Bezier       curves, Hermite splines, and so on.


          order -- Specifies the number of control points.  Must be positive.

         target -- Specifies the kind of values that are generated by the evaluator.  Symbolic

               constants      GL_MAP1_VERTEX_3,      GL_MAP1_VERTEX_4,      GL_MAP1_INDEX,

               GL_MAP1_COLOR_4,          GL_MAP1_NORMAL,          GL_MAP1_TEXTURE_COORD_1,

               GL_MAP1_TEXTURE_COORD_2,            GL_MAP1_TEXTURE_COORD_3,            and

               GL_MAP1_TEXTURE_COORD_4 are accepted.

         stride -- Specifies the number of floats or doubles between the beginning of one con-

               trol  point  and the beginning of the next one in the data structure refer-

               enced in points.  This allows control points to be  embedded  in  arbitrary

               data  structures.   The only constraint is that the values for a particular

               control point must occupy contiguous memory locations.

         opengl -- opengl instance

         u1, u2 -- Specify  a  linear  mapping  of u, as presented to glEvalCoord1, to uh, the

               variable that is evaluated by the equations specified by this command.


         points -- Specifies a pointer to the array of control points.

Returns: boolean


(define ctrlpoints (objc:vector->nsdata-float (vector (vector -5 -4 0) 

                                                      (vector -2 4 -1) 

                                                      (vector .5 -4 0) 

                                                      (vector 4 4 0))))

(gl:map-1 *gl* *gl:map1-vertex-3* 0.0 1.0 3 4 ctrlpoints)

(gl:enable *gl* *gl:map1-vertex-3*)

(define test

   (lambda (val)

      (gl:clear *gl* (io:binary-or *gl:color-buffer-bit* *gl:depth-buffer-bit*))

      (gl:load-identity *gl*)

      (gl:translate *gl* 0 0 -30)

      (gl:color *gl* 1 1 0 1)

      (gl:begin *gl* *gl:line-strip*)

      (dotimes (i (modulo val 50))

         (gl:eval-coord-1 *gl* (/ i 50)))

      (gl:end *gl*)

      (gl:flush *gl*)

      (callback (+ (now) 500) 'test (+ val 1))))

(test 0)

Back to index