Skip to content

Conversation

@flekschas
Copy link
Owner

This PR fixes the WebGL texture bug that appears when one frequently changed the point encoding (point color, size, and opacity)

Description

What was changed in this pull request?

  • Fix: destroy the encoding texture before recreating it
  • Fix: reject set() calls if the instance was destroyed
  • Fix: ensures unnecessary color and encoding texture updates are avoided
  • Fix: color and encoding textures are destroyed upon calling scatterplot.destroy()
  • Fix: prevent a minor memory leak in the newly added advanced exporter

Why is it necessary?

Fixes #165

Example

Before

After ~30 draw calls the WebGL described in #165 appears:

before.mp4

After

With this fix, the error does not appear:

after.mp4

I let it run until 1000 draw calls and everything worked just fine.

Checklist

  • Provided a concise title as a semantic commit message (e.g. "fix: correctly handle undefined properties")
  • CHANGELOG.md updated
  • Tests added or updated
  • Documentation in README.md added or updated
  • Example(s) added or updated
  • Screenshot, gif, or video attached for visual changes

In addition, this commit:
- rejects `set()` if the instance was destroyed
- ensures unnecessary texture updates are avoided
- color and encoding textures are destroyed upon calling `scatterplot.destroy()`
- fixes a small memory leak in the newly added advanced exporter where I forgot to unsubscribe a draw listener.
@flekschas flekschas merged commit c8a933e into main Jan 9, 2025
2 checks passed
@flekschas flekschas deleted the flekschas/prevent-premature-draw-calls branch January 9, 2025 14:49
flekschas added a commit that referenced this pull request Feb 10, 2025
* Fix: a regression from #208 where new colors wouldn't be set properly

Fix #214

* test: test adding a new point color

* test: add direct test for `isSameRgbas()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Displaying colors instead of dots after hiding and showing points multiple times.

2 participants