You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Optionally specify a size and pixel density separate from the main canvas or graphic
84
89
- If unspecified, the Framebuffer will resize when its canvas does
90
+
-`options.antialias: boolean`
91
+
- Turn on antialiasing by passing `true`
92
+
- WebGL2 (the default, if available) will use multisampled antialiasing
93
+
- WebGL1 will render at 2x the pixel density of the canvas for pseudo-antialiasing
85
94
86
95
Notes:
87
96
-`draw()` uses the same p5 context as the rest of your sketch! Make sure to wrap your callback code in a `push()` and `pop()` to ensure your settings don't leak out into your non-Framebuffer code.
88
97
- When you `resizeCanvas`, the Framebuffer will automatically resize accordingly. You probably will want to clear it and redraw to it if you had a texture cached.
89
98
90
99
A live example: https://davepagurek.github.io/p5.Framebuffer/examples/simple
- Returns the camera associated with the framebuffer by default
118
+
-`Framebuffer.prototype.createCamera()`
119
+
- Returns a new `p5.Camera` that matches the current dimensions of the framebuffer
120
+
121
+
An example of changing the size: https://davepagurek.github.io/p5.Framebuffer/examples/sizes
122
+
123
+
### WebGL 1
124
+
125
+
By default, this library will use WebGL 2 instead of WebGL 1. To use WebGL 1 mode, add this to the top of your sketch:
126
+
127
+
```js
128
+
Framebuffer.forceWebGL1=true
129
+
```
130
+
131
+
Note: Antialiasing in WebGL 1 mode works by rendering at 2x resolution instead of using a multisampled texture at 1x resolution.
132
+
133
+
Compare the resulting quality using WebGL 1 vs 2 in this example: https://davepagurek.github.io/p5.Framebuffer/examples/formats
134
+
92
135
### Floating point textures
93
136
94
137
Sometimes, you want to write code that adds on to or modifies the previous frame. You may notice weird artifacts that show up due to the fact that colors are internally stored as integers: sometimes if you overlay a color with a very small alpha, the change in color is too small to round the resulting color up to the next integer value, so it doesn't change at all.
0 commit comments