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

grid renderer for interactivity #147

Closed
ansis opened this issue Oct 23, 2013 · 3 comments
Closed

grid renderer for interactivity #147

ansis opened this issue Oct 23, 2013 · 3 comments

Comments

@ansis
Copy link
Contributor

ansis commented Oct 23, 2013

Rasterize features to a grid of ids that can be used to enable interaction.

We need to pass an id attribute to the shader.
Shader attributes can't be optional. Either we:

  • have a second set of shaders for grid rendering
  • set the a_id pointer to any data during normal rendering

The first option means more shaders to maintain. The second option is potentially slower, but I need to measure this. We could also generate shaders (this might be necessary for bluesky #146).

performance:

  • render only on move end
  • render only a single tile, lazily?
  • interweave grid rendering?

Initial attempt in gl-interaction

@kkaefer
Copy link
Contributor

kkaefer commented Oct 23, 2013

We should use an rtree instead. See #35.

@ansis
Copy link
Contributor Author

ansis commented Oct 23, 2013

I'm curious, what would be the advantage of using an rtree?

It seems like it would be way more complex. The rtree will narrow down the features by bounding box, but you'll need to iterate over all of them to find if they actually intersect. The intersection calculations would have to consider styles (sizes, widths, offsets, etc). Since the bounding box may change with zoom level, you need to consider that too. On top of that, you'd need to keep the original geometries. By reusing the renderer we get all of this automatically, and performance seems good.

@ansis
Copy link
Contributor Author

ansis commented Oct 23, 2013

The idea would be to transfer one pixel on each mousemove. While its a bit scary that readPixels is synchronous, it is (for me at least) < 1ms if you're only reading 1 pixel. Its < 10 ms if continuously repainting.

Tom had a negative reaction to the grid approach too, which probably means I'm missing something here

@ansis ansis closed this as completed Dec 11, 2013
bensleveritt pushed a commit to bensleveritt/mapbox-gl-js that referenced this issue Oct 24, 2016
Common Interface for sub controls and one store - fixes mapbox#148, fixes mapbox#149, fixes mapbox#137, fixes mapbox#133, fixes mapbox#104, fixes mapbox#94, fixes mapbox#89, fixes mapbox#144
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

No branches or pull requests

2 participants