experimental
experimental copied to clipboard
Make line_agg_collec work with document transform and latest vispy ModularProgram
@Cyrille: This modifies your agg line visual to use a document transform. To demonstrate the flexibility of this, I tossed in a polar transform.
The transforms look like this:
-
transformmaps from the data coordinates to the document coordinates, which I have defined as canvas pixels with 0,0 in the upper left. This transform is defined entirely using the panzoom, but this is not strictly necessary. The document coordinate system is where line widths are defined, and thus where they must be applied. -
doc_px_transformwould describe the difference between logical and physical pixels, but for us there will be no difference so it is an empty transform for now. We'll eventually need to test this on a high-res display.. -
px_ndc_transformmaps the rest of the way to NDC, and thus appears at the very end of the vertex shader. Bothdoc_pxandpx_ndcare defined by your Canvas subclass; eventually these should appear in the base Canvas class instead.There are probably still a few issues--I have not tested dashing, for example. I think for dashing to work correctly, it will be necessary to do the initial mapping to document coords on the CPU (because we can't measure distance along the path on the GPU).
Note: this depends on another PR: https://github.com/vispy/vispy/pull/315 You can pull the source branch if you want to try these changes before that PR is merged.
Thanks Luke, looks great! I'll try that soon.