-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Adding framebuffer support for filter() + CreateFilterShader for 2D mode #6559
Changes from 23 commits
198e456
8b71469
0ec719e
96bc262
72cd97b
6f0b715
2789e2a
2df0b03
f42da57
cefc285
9a86b19
75b0042
ae37304
e807740
1af2155
7fa39f6
683ed18
c250531
e4291cd
b073664
a353711
4a9bef9
2a330bf
6d04ec6
b1ec441
c01235f
8df7437
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
function setup() { | ||
// put setup code here | ||
// put setup code here | ||
} | ||
|
||
function draw() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,28 @@ class Renderer2D extends p5.Renderer{ | |
this._pInst._setProperty('drawingContext', this.drawingContext); | ||
} | ||
|
||
getFilterGraphicsLayer() { | ||
// create hidden webgl renderer if it doesn't exist | ||
if (!this.filterGraphicsLayer) { | ||
// the real _pInst is buried when this is a secondary p5.Graphics | ||
const pInst = | ||
this._pInst instanceof p5.Graphics ? | ||
this._pInst._pInst : | ||
this._pInst; | ||
|
||
// create secondary layer | ||
this.filterGraphicsLayer = | ||
new p5.Graphics( | ||
this.width, | ||
this.height, | ||
constants.WEBGL, | ||
pInst | ||
); | ||
} | ||
|
||
return this.filterGraphicsLayer; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before this, we might want to do a similar size matching to what we do in RendererGL with its framebuffer so that we ensure Maybe we can also copy and paste the current unit test that checks that the framebuffer gets resized in WebGL mode, and adapt it to check the size of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, i will do the changes asap. |
||
} | ||
|
||
_applyDefaults() { | ||
this._cachedFillStyle = this._cachedStrokeStyle = undefined; | ||
this._cachedBlendMode = constants.BLEND; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this intentionally deleted? Otherwise I think we can keep this file around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh... Sorry