glCoreTextureData - part-cw/lambdanative GitHub Wiki
(glCoreTextureData t)
glCoreTextureData returns texture data.
Parameter | Description |
---|---|
t | Texture for which data is returned |
Example
Example 1: Function that exports the content of a drawingarea, which can then be shown as a new texture elsewhere on the gui.
(define (glgui-drawingarea-export-image g wgt)
(let* ((t (glgui-widget-get g wgt 'data))
(w0 (table-ref t 'w0))
(h0 (table-ref t 'h0))
(color (glgui-widget-get g wgt 'color))
(len (length color))
(w (table-ref t 'w))
(h (table-ref t 'h))
(wr (table-ref t 'wr))
(hr (table-ref t 'hr)))
(let loop ((i 0) (ret (u8vector-alpha->u8vector-rgb (glCoreTextureData (table-ref t 0)) (car color))))
(if (fx= i (fx- len 1)) (list w h (glCoreTextureCreate w0 h0 ret) 0. 0. wr hr)
(loop (fx+ i 1) (u8vector-rgb-add ret (u8vector-alpha->u8vector-rgb (glCoreTextureData (table-ref t (fx+ i 1))) (list-ref color (fx+ i 1)))))
))))