Leaflet.glify icon indicating copy to clipboard operation
Leaflet.glify copied to clipboard

Differential Render

Open spencermize opened this issue 4 years ago • 2 comments

I haven't looked too much into the source yet to see if this is possible, but here's what I have going on:

  • Streaming JSON from the server (very large data set)
  • Using oboe.js to parse that data as it streams in
  • Rendering to a single layer in glify. So far, the best way I've found to do this is to just trigger render() every few seconds, but it feels hacky.

Currently, I'm using the same instance of Points, but then modifying the settings.data and calling the render() function.

  1. Is there a faster / better way to do this? I want to update the layer as the data emerges from the pipe.
  2. Is there a way to merely add points to the context, rather than re-rendering the entire thing? I'd love to be able to ditch my entire huge array once its rendered.

Any thoughts on this? I'm happy to help change code if necessary, but I thought I'd stick a message here first as I have little / no experience with WebGL beyond using it via Glify. Thanks!

spencermize avatar Apr 22 '20 12:04 spencermize

It appears I already (somewhat) posted about this in #24 😄

spencermize avatar Apr 22 '20 12:04 spencermize

I've hacked around on this. By adding a parameter such as clearOnRender to settings and combining with the preserveDrawingBuffer option, I was able to convince Glify to maintain the previous canvas:

if (this.clearOnRender){ gl.clear(gl.COLOR_BUFFER_BIT); }

However, there are negatives to this action:

  1. Click events stop functioning
  2. Panning and zooming get all kinds of messed up
  3. I'm sure others I haven't found yet

For my particular use, these are acceptable tradeoffs. However, I don't think it's wise to implement this in the larger library unless we can find ways to mitigate at least 1 and 2, and without a better understanding of 3.

spencermize avatar Apr 27 '20 13:04 spencermize