[Haskell-cafe] Packing Haskell values into a C array
Daniel Trstenjak
daniel.trstenjak at gmail.com
Sat Apr 26 19:21:28 UTC 2014
Hi Michael,
On Sat, Apr 26, 2014 at 01:24:00PM -0500, Michael Baker wrote:
> Specifically, I have a grid of 10,000 circles and I need to get them rendered.
> This involves translating the 10,000 circles into a single C array (of CFloats
> in my case) so that I can ship that array off to OpenGL for rendering. This
> is something I can't change, that's just the way OpenGL works.
Perhaps you don't need to change the Haskell representation that much,
but only memorize which cricles have change and only update these ones.
I would use a VertexBuffer-Object on the OpenGL side and memorize on the
Haskell side which circles have changed per frame. Then you could map
the VertexBuffer-Object and only update the corresponding coordinates.
It might make sense to use a Vector instead of a List, then you could
just memorize the indices of the changed Vector entries and the update
should be faster when indexing into a Vector instead of a List.
Greetings,
Daniel
More information about the Haskell-Cafe
mailing list