You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/tutorials/en/intro-to-p5-strands.mdx
+5-23Lines changed: 5 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -612,31 +612,21 @@ function draw() {
612
612
We do this by calling the following in the function we pass to `buildFilterShader()`:
613
613
614
614
```js
615
-
constogImage=uniformTexture(getOriginalImage)
615
+
constogImage=uniformTexture(originalImage)
616
616
```
617
617
618
618
This line does two things, representing the two halfs of a bridge between your sketch and your shader:
619
619
620
620
1. It declares a uniform variable in the shader called `ogImage` which expects to receive a value from outside the shader.
621
-
2. It causes your sketch to set that uniform variable **every frame** using [setUniform()](https://beta.p5js.org/reference/p5.Shader/setUniform/) on the shader. The given function (`getOriginalImage`) will be called each frame to decide the value to be passed to setUniform.
622
-
623
-
For step 2, perhaps it is helpful to _imagine_ the following code being run each frame:
(You shouldn't _write_ the above code - something like it is written and run for you, behind the scenes).
621
+
2. It causes your sketch to set that uniform variable **every frame** using [setUniform()](https://beta.p5js.org/reference/p5.Shader/setUniform/) on the shader, passing the value of `originalImage`.
628
622
629
623
Here's our `bloomCallback` function with this original canvas image being received by the shader and sampled from:
0 commit comments