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

Michael Baker michaeltbaker at gmail.com
Sun Apr 27 13:48:05 UTC 2014


On Sun, Apr 27, 2014 at 8:15 AM, Niklas Hambüchen <mail at nh2.me> wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140427/736a2c0f/attachment.html>

More information about the Haskell-Cafe mailing list