cables-gl / cables_docs

cables documentation docs.cables.gl
https://cables.gl/docs/docs
43 stars 14 forks source link

textureColorPick does not work within repeats #802

Open esperanc opened 1 month ago

esperanc commented 1 month ago

Link to simple, reproducible example patch The following patch shows the error. It has two almost identical branches, one, marked "incorrect" uses the standard textureColorPick op, while the other, marked "correct" uses a modified op which works error demo patch

Describe the bug The op fails in reading several pixels for coordinates stored in an array using a repeat op. To make it easier to reproduce, the patch reads two pixels from an array set manually with stringToArray. After reading the pixel for the first point, it does not update the result for the second point. The modified op uses readpixels directly, which does work. In the attached screenshot we should see two red circles and two blue circles, but we see 3 red circles and only one blue circle, which was produced by the modified op. cables_2024714_191710

How To Reproduce

  1. Open the error demo patch
  2. Observe the incorrect result

Platform

Dev Tools No useful hint there

pandrr commented 1 month ago

texture color pick is using an asynchronous method to read the pixel values, so it can not used in a repeat, it is executed when the gpu/driver decides it is a good moment without much delay

esperanc commented 1 month ago

texture color pick is using an asynchronous method to read the pixel values, so it can not used in a repeat, it is executed when the gpu/driver decides it is a good moment without much delay

Ok, but this is super counter-intuitive. At least, I think there should be something in the documentation to this effect - I spent a long time to figure this out! Perhaps if there was another op that would gather colors from a bunch of points in an array, this would be implied.