elm-explorations / webgl

Functional rendering with WebGL in Elm
https://package.elm-lang.org/packages/elm-explorations/webgl/latest/
BSD 3-Clause "New" or "Revised" License
116 stars 17 forks source link

Don't bind attribute buffers for the same program if they don't change #34

Open w0rm opened 4 years ago

w0rm commented 4 years ago

If the same mesh is rendered many times in a row using the same shaders, the current behaviour would still call gl.bindBuffer, gl.enableVertexAttribArray and gl.vertexAttribPointer for the same mesh. These extra calls could be potentially avoided.

This should improve the performance of 2D games with many sprites, that are rendered using the same quad mesh, the same shaders, but different uniforms. This should also improve the rendering of scenes like this http://unsoundscapes.com/elm-physics/examples/boxes/