Skip to content

Commit

Permalink
Merge pull request #6495 from RandomGamingDev/instancing-docs-fix
Browse files Browse the repository at this point in the history
A fix to the formatting of the documentation for endShape's instancing example
  • Loading branch information
davepagurek authored Oct 25, 2023
2 parents 28740f9 + c21c04e commit cdf8d91
Showing 1 changed file with 12 additions and 8 deletions.
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

0 comments on commit cdf8d91

Please sign in to comment.