Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/core/shape/vertex.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,8 @@ p5.prototype.endContour = function() {
*
* // gl_InstanceID represents a numeric value for each instance
* // using gl_InstanceID allows us to move each instance separately
* // here we move each instance horizontally by id * 100
* float xOffset = float(gl_InstanceID) * 100.0;
* // here we move each instance horizontally by id * 40
* float xOffset = float(gl_InstanceID) * 40.0;
*
* // apply the offset to the final position
* gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4 -
Expand Down Expand Up @@ -676,7 +676,7 @@ p5.prototype.endContour = function() {
* `;
*
* function setup() {
* createCanvas(400, 400, WEBGL);
* createCanvas(100, 100, WEBGL);
* fx = createShader(vs, fs);
* }
*
Expand All @@ -687,12 +687,16 @@ p5.prototype.endContour = function() {
* shader(fx);
* fx.setUniform('numInstances', 4);
*
* // this doesn't have to do with instancing, this is just for centering the squares
* translate(25, -10);
*
* // here we draw the squares we want to instance
* beginShape();
* vertex(30, 20);
* vertex(85, 20);
* vertex(85, 75);
* vertex(30, 75);
* vertex(30, 20);
* vertex(0, 0);
* vertex(0, 20);
* vertex(20, 20);
* vertex(20, 0);
* vertex(0, 0);
* endShape(CLOSE, 4);
*
* resetShader();
Expand Down