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

gltrace-add adds a data point to a trace.

Note: This doesn't update the texture immediately to save overhead but instead buffers new data points until gltrace-update is called.

Parameter Description
t Trace to which the datum is added
val Value of datum added

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