[Haskell-cafe] Packing Haskell values into a C array

Niklas Hambüchen mail at nh2.me
Sun Apr 27 13:15:34 UTC 2014

Yes, what Anthony says. I create the BufferObject from the Vector when
what I want to render changes (which happens less frequently than every
frame), and each frame then renders from the BufferObject.

If you want to change single elements, like he says, the mutable vector
should make you happy.

On 27/04/14 04:54, Anthony Cowley wrote:
>> So do you all just create a new vector every frame? Could you go into
>> a little more detail?
> You can create a new vector every frame, or you can use a mutable vector
> that you freeze before passing to 'fromVector' or 'replaceVector'. You
> can also investigate using, say, 10 vectors of 1k elements each if your
> updates are spatially correlated somehow.  I do the latter when I am
> generating new data over time, for example. The nice thing about using
> Vector is that you can use it like an array that you peek from and poke
> to, or you can take advantage of the fusion machinery to generate or
> update it on the Haskell side before shipping the underlying data off to
> OpenGL.
> The specifics of your update patterns will govern what is the best strategy.
> Anthony

More information about the Haskell-Cafe mailing list