diff --git a/public/assets/Brown_paper_bag_texture.jpg b/public/assets/Brown_paper_bag_texture.jpg index 97af3ad628..be81fe69bb 100644 Binary files a/public/assets/Brown_paper_bag_texture.jpg and b/public/assets/Brown_paper_bag_texture.jpg differ diff --git a/public/assets/DiagonalCrosswalkYongeDundas.webm b/public/assets/DiagonalCrosswalkYongeDundas.webm new file mode 100644 index 0000000000..5518a8ca67 Binary files /dev/null and b/public/assets/DiagonalCrosswalkYongeDundas.webm differ diff --git a/public/assets/Vancouver_(BC,_Canada),_Canada_Place_--_2022_--_1906.jpg b/public/assets/Vancouver_(BC,_Canada),_Canada_Place_--_2022_--_1906.jpg index a92b182ce3..d4027c7832 100644 Binary files a/public/assets/Vancouver_(BC,_Canada),_Canada_Place_--_2022_--_1906.jpg and b/public/assets/Vancouver_(BC,_Canada),_Canada_Place_--_2022_--_1906.jpg differ diff --git a/src/content/examples/en/11_3D/04_Filter_Shader/code.js b/src/content/examples/en/11_3D/04_Filter_Shader/code.js index 8815938c5a..f9ea1a693c 100644 --- a/src/content/examples/en/11_3D/04_Filter_Shader/code.js +++ b/src/content/examples/en/11_3D/04_Filter_Shader/code.js @@ -27,17 +27,15 @@ void main() { function setup() { createCanvas(700, 400, WEBGL); - video = createVideo( - '/assets/DiagonalCrosswalkYongeDundas.mp4' - ); + video = createVideo("/assets/DiagonalCrosswalkYongeDundas.mp4"); video.volume(0); video.hide(); video.loop(); - + displaceColors = createFilterShader(displaceColorsSrc); - + describe( - 'A video of a city crosswalk, with colors getting more offset the further from the center they are' + "A video of a city crosswalk, with colors getting more offset the further from the center they are", ); } @@ -45,12 +43,7 @@ function draw() { background(255); push(); imageMode(CENTER); - image( - video, - 0, 0, width, height, - 0, 0, video.width, video.height, - COVER - ); + image(video, 0, 0, width, height, 0, 0, video.width, video.height, COVER); pop(); filter(displaceColors); } diff --git a/src/content/examples/en/11_3D/07_Filter_Shader_p5strands/code.js b/src/content/examples/en/11_3D/07_Filter_Shader_p5strands/code.js index 09c558fc83..1a336a7a1e 100644 --- a/src/content/examples/en/11_3D/07_Filter_Shader_p5strands/code.js +++ b/src/content/examples/en/11_3D/07_Filter_Shader_p5strands/code.js @@ -3,15 +3,13 @@ let displaceColors; function setup() { createCanvas(700, 400, WEBGL); - video = createVideo( - '/assets/DiagonalCrosswalkYongeDundas.mp4' - ); + video = createVideo("/assets/DiagonalCrosswalkYongeDundas.mp4"); video.volume(0); video.hide(); video.loop(); displaceColors = buildFilterShader(displaceColorsCallback); describe( - 'A video of a city crosswalk, with colors getting more offset the further from the center they are' + "A video of a city crosswalk, with colors getting more offset the further from the center they are", ); } diff --git a/src/content/tutorials/en/intro-to-glsl.mdx b/src/content/tutorials/en/intro-to-glsl.mdx index 1df79b719c..9a7206e6b6 100644 --- a/src/content/tutorials/en/intro-to-glsl.mdx +++ b/src/content/tutorials/en/intro-to-glsl.mdx @@ -618,29 +618,24 @@ You can see the complete list of uniforms that p5.js provides for you in the [p5 For example, you may want to use a shape's texture coordinates in the fragment shader. These come in the form of a `vec2`, where coordinates go between 0 and 1. This initially comes in an `attribute` from p5.js, and those are only accessible in the vertex shader. Let's look at what our standard vertex shader does to pass that to fragment shaders: -` - precision highp float; +`precision highp float; attribute vec3 aPosition; ${begin('texcoord')} attribute vec2 aTexCoord; ${end('texcoord')} - attribute vec4 aVertexColor; - uniform mat4 uModelViewMatrix; uniform mat4 uProjectionMatrix; - ${begin('varying')} varying vec2 vTexCoord; ${end('varying')} - varying vec4 vVertexColor; void main() { // Apply the camera transform vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0); // Tell WebGL where the vertex goes gl_Position = uProjectionMatrix * viewModelPosition; ${begin('assign')} - vVertexColor = aVertexColor; + vTexCoord = aTexCoord; ${end('assign')} } `}>