Add a flag to indicate if the most recently created canvas is 3D
@spikyMalkallam is already working on this.
Since Oct 20, 2022.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Increasing Access
This will increase access under the following rubric: "People with little or no prior experience in open source and creative coding"
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build Process
- Unit Testing
- Localization Tools
- Friendly Errors
- Other (specify if possible)
Feature request details
While trying to figure out how to easily determine whether the current canvas is in 3D mode or 2D mode for a library I'm creating, I came across this SA article:
https://stackoverflow.com/questions/60931463/programmatically-detect-rendering-mode-in-p5js
It would appear that detecting the current canvas/p5.Graphics mode is less than straightforward. Many of the 3D methods throw an exception if you try to use them on a 2D canvas, so I think it would be useful to make it somewhat easier to determine the current mode.
I propose that we add a readonly property to p5 instances and p5.Graphics instances called .is3D, paralleling the existing .isP3D property of the p5.RendererGL class. Currently, you could also look at the _renderer property to see if it is an instance of p5.Renderer2D or p5.RendererGL, but that's no simpler than the solution proposed in the aforementioned SA article.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.