Sample code downloaded from Playground will result in an error

I tried to download the sample code from Babylon.js Playground.
However, I get an error when I try to do it.

The following is the reproduction procedure.

  1. Goto Babylon.js Playground
    https://playground.babylonjs.com/
  2. Download sample.zip
    image
  3. Unzip sample.zip
  4. Start a local server and access the sample URL.
    The following error occurs and the sample is not displayed.
Uncaught TypeError: Cannot read property 'runRenderLoop' of null

Probably because the initFunction is not called.

Correct! I forgot to fix that

thanks a lot, I will make that work

1 Like

BTW, it would be nice to be able to switch to WebGPU as well.

You can already in the PG but I do not plan to support it in the downloadable one (yet)
I mean: the downloadable version will use the same engine as the one active when you hit save

It’s not necessary to be able to download it, but it would be nice to be able to test it easily on Playground.

The following WebGPU documentation has a link to Playground.

it is already working :slight_smile:

Pinging @PirateJC for the doc update

1 Like

Oops, just noticed it. Great job.

2 Likes

Doc has been updated. Will go into the next PR within the next couple hours

3 Likes

Thank you for your quick fix. I have confirmed that the correct sample code can be downloaded for each mode of WebGPU / WebGL2.

WebGPU mode result:
image

WebGL2 mode result:
image

Sorry if this has already been addressed. I found another mistake.
The following URLs seem to refer to an old library (Babylon.js v4.2.0-alpha.16 or 27)

https://playground.babylonjs.com/indexWebGPU.html
https://www.babylonjs.com/demos/webgpu/forestwebgpu
https://www.babylonjs.com/demos/webgpu/oneSphereWebGPU
https://www.babylonjs.com/demos/webgpu/oneHelmetWebGPU
https://www.babylonjs.com/demos/webgpu/tenThousandSpheresWebGPU
1 Like

cc @Evgeni_Popov

Thank you for catching up. The last one is already posted in another thread.