post:XTMRENDERCB   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/kinect_vg.xtm

Implementation

(bind-func post:XTMRENDERCB
  (let ((image:VGImage (xtm_load_vgimage "assets/images/image.png"))
        (pathl (xtm_create_path))
        (pathr (xtm_create_path))
        (fill (vgCreatePaint))
        (fill_color:xtm_color* (alloc))
        (stroke (vgCreatePaint))
        (point:XTM_Point2d* (alloc))
        (stroke_color_left:xtm_color* (alloc))
        (stroke_color_right:xtm_color* (alloc))
        (clear_color:xtm_color* (alloc)))
    (afill! fill_color 1.0 0.0 0.0 1.0)
    (afill! stroke_color_left 1.0 0.0 0.0 1.0)
    (afill! stroke_color_right 0.0 1.0 0.0 1.0)
    (afill! clear_color 0.0 0.0 0.0 1.0)
    (xtm_paint_set_fill fill fill_color)
    ;; (xtm_paint_set_stroke stroke_left stroke_color_left 10.)
    ;; (xtm_paint_set_stroke stroke_right stroke_color_right 10.)
    (lambda (frame shader m v p data)
      (let ((i:float 0.0) (k 0)
            (ids:i64* (kinect_get_tracked)))
        (xtm_vg_reset_matrices)
        (xtm_vg_clear (convert width) (convert height) clear_color)
        ;; draw image
        (if (null? image) void (vgDrawImage image))
        ;; create the path (using the add_circle closure)
        (dotimes (k 6)
          (if (> (pref ids k) 0)
              (let ((left (kinect_get_hand_left (pref ids k)))
                    (right (kinect_get_hand_right (pref ids k))))
                ;; draw right
                (kinect_get_joint_xy (pref ids k) JointType_HandRight point)
                (afill! fill_color 0.0 0.0 1.0 1.0)
                (xtm_paint_set_stroke stroke stroke_color_left 10.)
                (if (> right 1)
                    (begin
                      (if (> right 2) (afill! fill_color 1.0 1.0 1.0 1.0))
                      (xtm_paint_set_fill fill fill_color)
                      (xtm_add_ellipse pathr (tref point 0) (- height (tref point 1)) 50.0 50.0)))
                (xtm_draw_path_keep pathr)
                (xtm_clear_path pathr)
                ;; draw left
                (kinect_get_joint_xy (pref ids k) JointType_HandLeft point)
                (afill! fill_color 0.0 0.0 1.0 1.0)
                (xtm_paint_set_stroke stroke stroke_color_right 10.)
                (if (> left 1)
                    (begin
                      (if (> left 2) (afill! fill_color 1.0 1.0 1.0 1.0))
                      (xtm_paint_set_fill fill fill_color)
                      (xtm_add_ellipse pathl (tref point 0) (- height (tref point 1)) 50.0 50.0)))
                (xtm_draw_path_keep pathl)
                (xtm_clear_path pathl))))
        ;; print any openvg errors
        (xtm_vg_print_error)
        void))))


Back to Index

Similar Entries

  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/slideshow.xtm
  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo_multi.xtm
  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/qr-code.xtm
  • postrender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender3.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender2.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender6.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender3.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender2.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender1.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender6.xtm
  • trans:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • trans:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • vector_gfx:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm