2008/10/28 T Willingham <[EMAIL PROTECTED]> > > As my first Haskell exposure, I've been working through Real World > Haskell. > > I am considering converting some of my C++ graphics libraries to > Haskell. I've done a fair amount of googling on the subject, however > I haven't quite been able to find clear answers to some of following > issues. > > (1) Using an OpenGL vertex array (a contiguous chunk of memory which > is handed to the graphics card) is important. I see the source code > of Frag does this, so it looks like we're good. Check. > > (2) In-place modification of the vertex array is important. Every > vertex changes on each frame update. And we always want more > vertices. > > (3) Growing and shrinking the vertex array efficiently is important. > Here the behavior of C++ std::vector happens to be ideal. When > growing, extend the array in-place if possible (using reserved space > if any), otherwise allocate a new chunk ("amortized constant time"). > When shrinking, do nothing but record the smaller size; the unused > memory chunk is reserved for possible future growth. > > (4) Doing little to no allocations each frame update is important. In > the current C++ version, zero allocations occur during a normal frame > update. When the vertex array changes, that is the only allocation > which happens. > > To give a context for all of this, I am applying a non-linear > transformation to an object on every frame. (Note: non-linear, so a > matrix transform will not suffice.) >
Any reason why you can not do this in the vertex shader? You really should avoid trying to touch the vertices with the CPU if at all possible. -- Sebastian Sylvan +44(0)7857-300802 UIN: 44640862
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe