sebcrozet/kiss3d

Rolling average window

Opened this issue · 0 comments

Hello and thanks for this great library.

I wish to render two windows - the first shows the raw data coming from a data stream, and the second is a rolling average of a few frames from that first window. I already have the raw data renderer working, but I'm struggling to decide on the best way to implement that moving average part.

Naively I can snap_image() the first window to receive the data of each frame and average it with some existing buffer, but I'm not sure how to convert the ImageBuffer I'll have back to a renderable image. Would I need to iterate over every pixel and call add_point() on it?

Another option is to do everything on the GPU, since my data is already there. However I'm not quite sure that the GPU API kiss3d exposes is sufficient for this task (and probably for a good reason!). I'm not sure how to allocate a mutable GPU buffer as my new window's buffer and use an averaging kernel to update it with data from a different window, which has its own buffer.

How would you recommend approaching this task?