-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Labels
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
All (1.x and 2.x)
Web browser and version
All
Operating system
All
Steps to reproduce this
Steps:
- Create a framebuffer
- In
fbo.draw()callback: push(), apply anortho()camera, and draw somethingpop()so the camera should be reset, then draw something else- Draw that to the main canvas
After the pop, the outlines are kinda messed up:
When doing the same thing to the main canvas, with push/pop instead of fbo.draw, the ortho() gets correctly reset:
Snippet:
let drawToFBO = true
let fbo
function setup() {
createCanvas(400, 400, WEBGL);
setAttributes({ antialias: true })
fbo = createFramebuffer()
}
function draw() {
background(220);
imageMode(CENTER)
if (drawToFBO) fbo.begin()
push()
ortho()
translate(0, -100)
for (let i = -3; i <= 3; i++) {
push()
translate(i * 50, 0)
box(40)
pop()
}
pop()
push()
translate(0, 100)
for (let i = -3; i <= 3; i++) {
push()
translate(i * 50, 0)
box(40)
pop()
}
pop()
if (drawToFBO) {
fbo.end()
image(fbo, 0, 0)
}
}Live: https://editor.p5js.org/davepagurek/sketches/_h8ZxlaP9