Closed kragol closed 4 years ago
The ids are written to a texture when the plot is rendered, which contains two UInt8
s. Changing the UInt16
here to a UInt32
won't change that.
I think it might be enough to change
https://github.com/JuliaPlots/GLMakie.jl/blob/3e9caf368ba3075a21252f58cadfb8bd521bb34e/src/glwindow.jl#L35
and
https://github.com/JuliaPlots/GLMakie.jl/blob/3e9caf368ba3075a21252f58cadfb8bd521bb34e/src/glwindow.jl#L162
to GLuint
with sid = Base.RefValue{SelectionID{UInt32}}()
.
Thanks @ffreyer , that seems to work (see the PR).
There seems to be a problem with the
GLMakie
implementation ofpick
that results in returned indices being capped at 65535. In practice, this means that pick does not work as expected for plots with more than 65535 points.Here is a MWE, tested with the latest
Makie
release (0.11.1) and also themaster
branch.This displays a simple scatter plot with 100_000 points and prints the index of the hovered point to stdout. Everything works as expected while hovering points with x,y coordinates <= 65535. However, the returned index is always 65535 for points with coordinates >= 65535.
The issue seems to be related to the implementation of
pick_native
inGLMakie
( at screen.jl:392 on master):Here, the returned index is typed as
UInt16
which explains the 65535 threshold. However, simply usingUInt32
instead here does not solve the problem (it seems to result in an error), which seems to indicate thatglReadPixels
somehow returns anUInt16
. I gave up on further investigations as I am not familiar enough with OpenGL.As for a workaround one can manually look for the point minimizing the distance to the mouse pointer. For instance, this can be done in data space by comparing the mouse coordinates with the data coordinates
( using
mouse_in_scene
here instead ofscene.events.mouseposition
to avoid issues with subscenes. It doesn't actually change anything for this example. )However I am not sure how to do the distance minimization in "pixel space", which would be a more intuitive behaviour. The problem is that I haven't found the function mapping coordinates to pixels (the inverse of
to_world
)...