p5.js-website
p5.js-website copied to clipboard
Example on the learn page is broken
Most appropriate sub-area of p5.js?
- [ ] Accessibility
- [ ] Color
- [ ] Core/Environment/Rendering
- [ ] Data
- [ ] DOM
- [ ] Events
- [ ] Image
- [ ] IO
- [ ] Math
- [ ] Typography
- [ ] Utilities
- [x] WebGL
- [ ] Build Process
- [ ] Unit Testing
- [ ] Internalization
- [ ] Friendly Errors
- [ ] Other (specify if possible)
p5.js version
1.9.0
Web browser and version
Chrome
Operating System
Windows11
Steps to reproduce this:
Steps:
- Go to : https://p5js.org/learn/getting-started-in-webgl-appearance.html
- The example explaining, how one camera can be active at a time, the default single perspective camera can be changed by calling either perspective() (with new parameters) or ortho() fails drawing when uncommented to change the perspective camera to orthographic.
Snippet:
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
debugMode()
// uncomment to change the perspective camera to orthographic
// ortho();
// setting initial camera position
camera(200,-40, 200);
describe('a 3d scene with a sphere on the bottom and box on the top');
}
function draw() {
background(220);
let sphere_x = 0;
let sphere_y = 90;
let sphere_z = 0;
let box_x = 0;
let box_y = -90;
let box_z = 0;
// uncomment to point camera at sphere
// camera(
// 400,-40, 400, // camera position
// sphere_x, sphere_y, sphere_z // position to look at
// );
// uncomment to point camera at box
// camera(
// 400,-40, 400, // camera position
// box_x, box_y, box_z // position to look at
// );
push();
translate(sphere_x, sphere_y, sphere_z);
sphere(40,8);
pop();
push();
translate(box_x, box_y, box_z);
box();
pop();
}
Screenshots:
Uncommenting ortho as directed in the example to demonstrate the change of default perspective, the drawing fails.