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
Copy file name to clipboardExpand all lines: src/content/contributor-docs/en/webgl_mode_architecture.mdx
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -233,26 +233,26 @@ It also has the following per-vertex attributes:
233
233
title: p5.js WebGL Classes
234
234
---
235
235
classDiagram
236
-
class Base["p5.Renderer"] {
237
-
}
238
-
class P2D["p5.Renderer2D"] {
239
-
}
240
-
class WebGL["p5.RendererGL"] {
241
-
}
242
-
class Geometry["p5.Geometry"] {
243
-
}
244
-
class Shader["p5.Shader"] {
245
-
}
246
-
class Texture["p5.Texture"] {
247
-
}
248
-
class Framebuffer["p5.Framebuffer"] {
249
-
}
250
-
Base <|-- P2D
251
-
Base <|-- WebGL
252
-
WebGL "*" o-- "*" Geometry
253
-
WebGL "1" *-- "*" Shader
254
-
WebGL "1" *-- "*" Texture
255
-
WebGL "1" *-- "*" Framebuffer
236
+
class Base["p5.Renderer"] {
237
+
}
238
+
class P2D["p5.Renderer2D"] {
239
+
}
240
+
class WebGL["p5.RendererGL"] {
241
+
}
242
+
class Geometry["p5.Geometry"] {
243
+
}
244
+
class Shader["p5.Shader"] {
245
+
}
246
+
class Texture["p5.Texture"] {
247
+
}
248
+
class Framebuffer["p5.Framebuffer"] {
249
+
}
250
+
Base <|-- P2D
251
+
Base <|-- WebGL
252
+
WebGL "*" o-- "*" Geometry
253
+
WebGL "1" *-- "*" Shader
254
+
WebGL "1" *-- "*" Texture
255
+
WebGL "1" *-- "*" Framebuffer
256
256
```
257
257
258
258
The entry point to most WebGL code is through **p5.RendererGL**. Top-level p5.js functions are passed to the current renderer. Both 2D and WebGL modes have renderer classes that conform to a common `p5.Renderer` interface. Immediate mode and retained mode functions are split up into `p5.RendererGL.Immediate.js` and `p5.RendererGL.Retained.js`.
@@ -271,4 +271,4 @@ Currently, WebGL mode is functional for a variety of tasks, but many users and l
271
271
272
272
***Extend p5.Geometry to support richer content.** Creating geometry is possible, but many tasks a user might want to accomplish are not yet supported with a stable API. One might want to efficiently update geometry, which is necessary to support animated gltf models. One might want to group multiple materials in one object, if they are present in an imported model. One might want to add custom vertex attributes for a shader to work with. These tasks are currently unsupported.
273
273
***Enable less brittle custom shaders.** To create a shader that integrates p5.js's lighting and materials system, a user is currently forced to create shaders from scratch. These shaders often copy and paste parts of default shaders. This may break between versions if internal naming or structure changes. To be less brittle, libraries should be able to import and reuse default pieces. This lets libraries reuse positioning logic or augment positioning logic but reuse shading logic. There is currently [an issue open for this task.](https://github.com/processing/p5.js/issues/6144/)
274
-
***Improve performance.** WebGL mode tries to strike a balance between features and performance. One method is to introduce APIs to tune output quality, like how `curveDetail()` allows faster but lower-quality curves. Line rendering is one of the common performance bottlenecks in its present state, and it could benefit from having lower fidelity but higher performance options. Another method is to introduce new types of objects and rendering methods that are optimized for different usage patterns, like how `endShape(shouldClose, count)` now supports WebGL 2 instanced rendering for more efficient drawing of many shapes.
274
+
***Improve performance.** WebGL mode tries to strike a balance between features and performance. One method is to introduce APIs to tune output quality, like how `curveDetail()` allows faster but lower-quality curves. Line rendering is one of the common performance bottlenecks in its present state, and it could benefit from having lower fidelity but higher performance options. Another method is to introduce new types of objects and rendering methods that are optimized for different usage patterns, like how `endShape(shouldClose, count)` now supports WebGL 2 instanced rendering for more efficient drawing of many shapes.
0 commit comments