Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A fix to the formatting of the documentation for endShape's instancing example #6495

Merged
merged 1 commit into from
Oct 25, 2023
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
Loading