-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Description
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
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
v2.2.1, v2.2.3 (beta)
Web browser and version
Chrome, 146.0.7680.154
Operating system
Windows 11 Version 25H2 (Build 26200.7840)
Steps to reproduce this
Steps:
- Create a supplementary WEBGL canvas, here "graphics2"
- Try to load a model and display it on that canvas
- following error: TypeError: graphics2.model is not a function
(TypeError: graphics2.model is not a function
at (anonymous function) (/sketch.js:14:15))
workaround: use graphics2._renderer.model() instead -> so I guess the model() function is not "exposed" properly for p5.Graphics objects?
Snippet:
(can also be accessed under my p5js.org sketches here)
let graphics2;
let model1;
function setup() {
createCanvas(400, 400);
graphics2 = createGraphics(300,300,WEBGL)
model1 = loadModel("meeple1.obj")
.then(mdl => {
graphics2.noStroke();
graphics2.background("#FFEEC2");
graphics2.scale(10);
graphics2.fill("#b4936d");
graphics2.rotate(TAU/2);
graphics2._renderer.model(mdl); // graphics2.model outputs error that .model is not a function, only works like this
graphics2.box(4); //box works
});
}
function draw() {
background("#583961");
image(graphics2, 10, 10, width-20, height-20);
}Reactions are currently unavailable