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: apps/docs/content/docs/integrations/react-three-fiber.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: React Three Fiber
3
3
description: Integrations demo - declarative 3D with @react-three/fiber.
4
4
---
5
5
6
-
Builds on [Three.js](/docs/integrations/three-js): same `WebGPURenderer`, canvas adapter, and **`present()`** hook - but scenes are JSX reconciled by React Three Fiber.
6
+
Builds on [Three.js](/docs/integrations/three-js): same `WebGPURenderer` and **`present()`** hook - but scenes are JSX reconciled by React Three Fiber.
get clientWidth() { returnthis.canvas.clientWidth; }
51
-
get clientHeight() { returnthis.canvas.clientHeight; }
52
-
53
-
// Three.js may call these - no-ops are fine on RN
54
-
addEventListener() {}
55
-
removeEventListener() {}
56
-
dispatchEvent() { returnfalse; }
57
-
setPointerCapture() {}
58
-
releasePointerCapture() {}
59
-
}
60
-
```
61
-
62
-
## 3. Create the renderer
63
-
64
-
Pass the adapter and the **same**`GPUCanvasContext` you got from React Native WebGPU:
38
+
`WebGPURenderer` expects a DOM-like canvas with `width`, `height`, `clientWidth`, and `clientHeight`, plus a few event methods. The native canvas from `getContext("webgpu")` already satisfies this interface, so pass it directly along with the **same**`GPUCanvasContext`:
@@ -83,7 +53,7 @@ export function makeWebGPURenderer(context: GPUCanvasContext) {
83
53
`WebGPURenderer.init()` is **async**. Do not call `render()` until it resolves - unlike raw WebGPU where pipeline creation is synchronous after `requestDevice`.
84
54
</Callout>
85
55
86
-
## 4. Render loop + present
56
+
## 3. Render loop + present
87
57
88
58
Configure the context once ([Canvas](/docs/getting-started/canvas)), then animate:
0 commit comments