Tearable cloth in asm.js
jlongster.com
jlongster.com
EDIT: I shouldn't have said "no idea". There is one reason I can think of -- this uses WebGL, so if you have a bad card or drivers this might be slower. My algorithms might be more precise too, I don't know the other code.
EDIT2: A coworker just mentioned that I should turn off antialiasing (it's on by default) and that should help a lot of machines. Also optimized WebGL a few other ways.
I don't know what the cause is in my case, maybe WebGL on this thinkpad is really slower than CPU rendering on an Atom?
Opened up FireBug; the console had the following error at line 18 of renderer.js:
> NS_ERROR_FAILURE: Failure > this.gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl')
EDIT: It doesn't work in FF 20.0.1 either... Win 7
You gotta wrap that stuff in try/catch (at least the getContext call, as a minimum). I don't think this is spec compliant, but I've seen it in Firefox, Chrome and Opera under various configurations.
This uses WebGL, so there's potential that you have a bad driver/video card that this will be slow. That's the only reason I can think of.
Cool demo! I don't know much about this sort of stuff, could you talk about what's going on in the vertlet.js file a bit?
[0]http://subprotocol.com/verlet-js/ [1]https://news.ycombinator.com/item?id=5580596