From 9dd7db11048be86151aaf031165e491858ba7877 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 10 Jun 2026 20:08:52 -0700 Subject: [PATCH 1/2] update tutorial snippet to pass proper varying from vertex shader to fragment shader --- src/content/tutorials/en/intro-to-glsl.mdx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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')} } `}> From 12d55be01b7bc5774434a3fb3d8da3a08a9d461c Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 10 Jun 2026 20:54:18 -0700 Subject: [PATCH 2/2] whitespace update --- src/content/tutorials/en/intro-to-glsl.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/tutorials/en/intro-to-glsl.mdx b/src/content/tutorials/en/intro-to-glsl.mdx index 9a7206e6b6..43083bfcc0 100644 --- a/src/content/tutorials/en/intro-to-glsl.mdx +++ b/src/content/tutorials/en/intro-to-glsl.mdx @@ -635,7 +635,7 @@ For example, you may want to use a shape's texture coordinates in the fragment s // Tell WebGL where the vertex goes gl_Position = uProjectionMatrix * viewModelPosition; ${begin('assign')} - vTexCoord = aTexCoord; + vTexCoord = aTexCoord; ${end('assign')} } `}>