I think you should build a new Visual. Take a look at the line_prototype.py example, have you seen it? It describes what needs to be added to make a functional Visual. Then you'd use the create_visual_node (I think that's the name) to turn it into a Node that can be used in a scenegraph. And then you'd set the parent of the Visual to the scene of the ViewBox in use, which you'll see in many Scene examples.
Eric
--
You received this message because you are subscribed to the Google Groups "vispy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vispy+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> I think you should build a new Visual
wow, this really is a rabbithole. so the Visual basically wraps the gl shader code using template variables and makes it compatible with the scene graph machinery? so what i would be creating is a sort of a point cloud Visual with built-in resizing of the point sprites to the viewer distance. sounds like the right thing, but also somewhat daunting. postponed for now. anyway, thanks for your reply!
--
> I think you should build a new Visual
wow, this really is a rabbithole. so the Visual basically wraps the gl shader code using template variables and makes it compatible with the scene graph machinery? so what i would be creating is a sort of a point cloud Visual with built-in resizing of the point sprites to the viewer distance. sounds like the right thing, but also somewhat daunting. postponed for now. anyway, thanks for your reply!
It is a rabbithole. The cameras are not meant to be used outside the scenegraph, and there's a steep learning curve for developing new visuals. My approach would be to modify Markers to support the features you need.
ok, that may be more palatable. i did try briefly to adapt the line_prototype to my problem. i quickly hit an obstacle: in order to do the marker-size determination for correct resizing of physical objects as in molecular_viewer, it's necessary to know the distance to the camera
You could also go the route of using a set of spheres, combined with a perspective camera. Then you get the shrinkage/growth based on distance automatically.
1. Map the center position of the point (call this c) to document coordinates (call this c').2. Add to that `vec2(1, 0)` (call this px') and map the resulting point back to the visual's coordinates (call this px). Now you know the length of a pixel (at least in one direction) in the coordinate system of your data.3. Divide the diameter of the point by the length of the mapped pixel vector; this gives you the point size you need in pixels: GL_PointSize = diameter / length(px - c)
--
The idea with that is that it should be done in GLSL / the vertex shader, so doing it for every point is automatically parallelized.
--