Glad you were able to find a solution! Elm WebGL support is primitive and unofficial. If you run into performance issues, the culprit is probably the elm-webgl package and not the underlying language/platform.
On Sun, Nov 6, 2016 at 4:56 AM, Gaëtan André <[email protected]> wrote: > OK I solved my problem. > > Culling foodElements (little green circles) to the screen led to less > webgl calls which solved the smoothness problem. > > Webgl api calls are costly. Maybe a a way to reduce the number of calls in > my case could have been to use a geometry shader to instantiate multiple > food elements. Anyway culling at application level works fine. > > Thanks for your help. > > > Le samedi 5 novembre 2016 11:27:52 UTC+1, Gaëtan André a écrit : >> >> viewGrid was reworked as you suggested (cf. gist) but the the problem is >> still the same. >> >> Sorry I had not share the cpu profiles from Chrome the first time, I do >> it now. As you can see, the problem is that sometimes, a loop call takes a >> lot longer than others to compute (because of gc it seems). >> >> On Chrome it is basically annoying but still playable, on Firefox it is >> not playable. >> >> Thanks, >> >> Le jeudi 3 novembre 2016 02:33:35 UTC+1, Nick H a écrit : >>> >>> I am guessing your viewGrid function is slowing your code down. This >>> function is creating a new mesh and passing it to the GPU on every >>> animation frame. >>> >>> The solution is to make sure your WebGL.Drawable (line 465, where it >>> says "GL.Lines gridPoints") is a constant. So extract that into its own >>> top-level declaration, as you have done with "mesh." >>> >>> On Wed, Nov 2, 2016 at 1:30 PM, Gaëtan André <[email protected]> >>> wrote: >>> >>>> Hello everybody, >>>> >>>> I am working on cloning Agar.io (https://agar.io/) using functionnal >>>> languages. >>>> Everything was going well except that my cell movements are not very >>>> smooth. >>>> I first blamed the network connection, but after hacking a standalone >>>> front-end it seems like Elm might have something to do with it. >>>> >>>> From were I am, I don't know where to go to improve fluidity. >>>> >>>> I am subscribing to AnimationFrame.diffs to give the pace of the render >>>> loop. >>>> >>>> Here is a gist of my code: >>>> https://gist.github.com/rvlander/0b956d5d8d0a70f37f6206cb6f9af367 >>>> >>>> Thanks, >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Elm Discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
