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

WebGL mode documentation improvements #6167

Merged
merged 19 commits into from
Jun 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
9 changes: 9 additions & 0 deletions src/core/shape/2d_primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ p5.prototype._normalizeArcAngles = (
* </code>
* </div>
*
* <div>
* <code>
* createCanvas(100, 100, WEBGL);
* arc(0, 0, 80, 80, 0, PI + QUARTER_PI, PIE, 7);
* describe(
* 'ellipse with a quarter missing, and the outline is segmented instead of curved'
* );
* </code>
* </div>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The round 2D primitives have a detail parameter, so technically for completeness they could use an example like this to show it in action.

But I think it would distract from useful parameters and examples, and detail doesn't seem like a popular feature for users, and detail is already documented well in curveDetail() and bezierDetail() and the 3D primitives.

Maybe this should make it into the list of WEBGL vs P2D differences? Something like:

  • Vertex Count - When drawing curved shapes in WEBGL mode, you can specify how many vertices are drawn with a detail parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of Vertex Count I think we can use p5's existing language and call it Shape Detail.

Also I don't think additional examples detracts and to be honest I didn't realize the round 2d shapes even had that parameter. I think it would be a good addition, and as you note, the 3d shapes include this, so why not 2d as well?

https://p5js.org/reference/#/p5/sphere

*/
p5.prototype.arc = function(x, y, w, h, start, stop, mode, detail) {
p5._validateParameters('arc', arguments);
Expand Down