pmndrs / react-three-offscreen

📺 Offscreen worker canvas for react-three-fiber
https://offscreen.pmnd.rs
MIT License
434 stars 14 forks source link

Defining DPR leads to error #4

Open samevision opened 1 year ago

samevision commented 1 year ago

Hi,

if you set the dpr prop of Canvas - e.g. dpr={[1, 2]} - it throws the following error:

Failed to set the 'width' property on 'OffscreenCanvas': Value is not of type 'unsigned long'.
    at WebGLRenderer.setSize (webpack-internal:///(app-client)/./node_modules/three/build/three.module.js:28279:17)
    at WebGLRenderer.setPixelRatio (webpack-internal:///(app-client)/./node_modules/three/build/three.module.js:28257:9)

Best

drcmda commented 1 year ago

are you trying last version? it seems to work

samevision commented 1 year ago

Yes, I am on 0.0.5. It seems to work fine but it is throwing the error mentioned above as soon as I set the parameter.

drcmda commented 1 year ago

how do you set it, by hot reload? is it OK on the first load?

samevision commented 1 year ago

My canvas looks like this:


<Canvas
    dpr={[1, 2]}
    worker={worker}
    fallback={<Scene />}
/>

I am using nextjs but the error appears in dev environment as well as after build in production. So hot reload shouldn't be a problem.