Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

gltrace-update updates a trace. This updates the texture of the trace with points added by gltrace-add since the last call of gltrace-update. Note that gltrace-update must be called in the event loop, as it uses OpenGL.

Parameter Description
t Trace to be updated

Example

Example 1: Trace a fake waveform. First define the trace with its boundaries. Then place a trace-widget on the screen. Finally, clear the trace, load some data and update the trace. In a real world application the gltrace-add and gltrace-update would happen in a loop elsewhere, whenever new data are received.

(set! VAL_min 0)(set! VAL_max 10)
(set! val-trace (make-gltrace 101 30 GLTRACE_OVERWRITE VAL_min VAL_max VAL_min VAL_max))
(gltrace:clear val-trace)
(set! val-wave (glgui-trace gui 5 (- (glgui-height-get) 44 110) 200 40 val-trace Orange))
(set! values (list 0 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 6 7 7 9 5 4 3 2 1 3 4 5 6 4 4 3 3 2 2 1 1 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 0 0 1 1 2 2 3 3 4 4 5 5))
(let loop ((i 0))
  (if (< i (length values))
    (begin
      (gltrace-add val-trace (list-ref values i))
      (loop (+ i 1))
  )))
...
(gltrace-update val-trace) ;; this must be called in the event loop
Clone this wiki locally