Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement better (more maintainable) way to redraw gl canvases on incremental updates #2562

Closed
etpinard opened this issue Apr 16, 2018 · 1 comment
Labels
bug something broken

Comments

@etpinard
Copy link
Contributor

Now that we have multiple regl-based traces sharing the same gl canvases and relying on the same global src/lib/clear_gl_canvases.js routine, we'll need a better way to redraw things on updates (e.g. on selections but also restyle and relayout calls).

Here's an example from #2505, style here is called during selections:

function style(gd, cds) {
if(!cds) return;
var fullLayout = gd._fullLayout;
var cd0 = cds[0];
var scene0 = cd0[0].t._scene;
scene0.matrix.regl.clear({color: true, depth: true});
if(fullLayout._splomGrid) {
fullLayout._splomGrid.draw();
}
for(var i = 0; i < cds.length; i++) {
var scene = cds[i][0].t._scene;
scene.draw();
}
// redraw all subplot with scattergl traces,
// as we cleared the whole canvas above
if(fullLayout._has('cartesian')) {
for(var k in fullLayout._plots) {
var sp = fullLayout._plots[k];
if(sp._scene) sp._scene.draw();
}
}
}

Here, we clear the canvases and redraw splom things with new selected/unselected batches, but then ooops we also need to add logic for scattergl traces in the splom method so that they don't disappear on splom updates.


So, I propose (and I'm sure @dy will find a way to improve this proposal) to store a graph-wide queue of regl module draw calls (e.g. fullLayout._reglDrawQueue) that we could call everything we clear the canvases to update something. The new update sequence will (1) clear the canvases (or only parts of it if we can) (2) update selected buffers (3) call reglDrawQueue to redraw all things.

@etpinard
Copy link
Contributor Author

etpinard commented Oct 4, 2018

Done in #3067, merged in master during #3057

@etpinard etpinard closed this as completed Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

1 participant