Schmavery / reprocessing

ReasonML graphics library inspired by Processing
https://schmavery.github.io/reprocessing/
MIT License
679 stars 24 forks source link

Use some arcane magic to pack the vertex data more tightly #119

Open bsansouci opened 5 years ago

bsansouci commented 5 years ago

Right now we are transforming our RGBA colors to floats and sending those to the GPU. That's a total of 16 bytes, but the precision of the colors based on the API is really just 0 to 255, so we should be able to only use 4 bytes instead. To do that we'd have to write some C code to cast the bigarray to an array of char and set the rgba. In JS we should be able to call setUInt8 (something like this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/setInt8).