Skip to content

Commit 46842d0

Browse files
committed
Clean up examples a bit
1 parent 98fc10c commit 46842d0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/webgl/p5.Shader.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,15 @@ class Shader {
297297
* createCanvas(200, 200, WEBGL);
298298
* myShader = baseMaterialShader().modify(() => {
299299
* getPixelInputs((inputs) => {
300-
* inputs.color = [1, 0, 0, 1];
300+
* inputs.color = [inputs.texCoord, 0, 1];
301301
* return inputs;
302302
* });
303303
* });
304304
* }
305305
*
306306
* function draw() {
307307
* background(255);
308+
* noStroke();
308309
* shader(myShader); // Apply the custom shader
309310
* plane(width, height); // Draw a plane with the shader applied
310311
* }
@@ -327,14 +328,19 @@ class Shader {
327328
* let t = uniformFloat(() => millis());
328329
*
329330
* getPixelInputs((inputs) => {
330-
* inputs.color = [sin(t * 0.01) / 2 + 0.5, 0, 0, 1];
331+
* inputs.color = [
332+
* inputs.texCoord,
333+
* sin(t * 0.01) / 2 + 0.5,
334+
* 1,
335+
* ];
331336
* return inputs;
332337
* });
333338
* });
334339
* }
335340
*
336341
* function draw() {
337342
* background(255);
343+
* noStroke(255);
338344
* shader(myShader); // Apply the custom shader
339345
* plane(width, height); // Draw a plane with the shader applied
340346
* }
@@ -354,14 +360,15 @@ class Shader {
354360
* sketch.createCanvas(200, 200, sketch.WEBGL);
355361
* myShader = sketch.baseMaterialShader().modify(() => {
356362
* sketch.getPixelInputs((inputs) => {
357-
* inputs.color = [1, 0, 0, 1];
363+
* inputs.color = [inputs.texCoord, 0, 1];
358364
* return inputs;
359365
* });
360366
* }, { sketch });
361367
* }
362368
*
363369
* sketch.draw = function() {
364370
* sketch.background(255);
371+
* sketch.noStroke();
365372
* sketch.shader(myShader); // Apply the custom shader
366373
* sketch.plane(sketch.width, sketch.height); // Draw a plane with the shader applied
367374
* }

0 commit comments

Comments
 (0)