astrosat / windgl

A WebGL wind particle simulation as a Mapbox custom layer
https://astrosat.github.io/windgl/
ISC License
170 stars 45 forks source link

Fix shader code and add webgl flush #17

Open maeneak opened 5 years ago

maeneak commented 5 years ago

Code changes to fix floating point bug from #12 and reduce particle flickering on mobile browsers. I've also added a small update to particle.js for 2 random DOMMatrix definitions not using the window object which were blocking the use of polyfills for browsers that dont support the Geometry Interfaces spec (edge desktop etc.). The use of DOMMatrixReadOnly in util.js also blocks this and replacing it with DOMMatrix tests fine, is there any benifit in using DOMMatrixReadOnly?

gampleman commented 5 years ago

is there any benifit in using DOMMatrixReadOnly

Not really, just being paranoid about mutating stuff that shouldn't be.

maeneak commented 5 years ago

You may be able to find a more elegant way to do the gl.flush(). Most of my research came from https://github.com/pixijs/pixi.js/issues/3432 I didn't do any testing on whether it was required in both render and prerender calls.

j08lue commented 4 years ago

As far as I can see, these are relevant and localized changes. Probably not tested in a while, but can this perhaps just be merged? The original branch is gone, it seems, and it would be too bad to lose this fix. We can give it a spin and report back, if this gets merged.