GLTF/GLB Loader Error

Hi. For my project, I’ve been loading in GLTF files as so:

let loader = BABYLON.SceneLoader.ImportMesh("", “./”, “Assets/BoomBox.glb”, scene);

Everything was working fine for the most part.

I believe it was after this commit here

where I started to see errors. The messages I’ve been getting are

Unable to import meshes from ./Assets/BoomBox.glb: Argument 6 is not valid for any of the 6-argument overloads of WebGL2RenderingContext.texImage2D.

TypeError: Argument 6 is not valid for any of the 6-argument overloads of WebGL2RenderingContext.texImage2D.

Am I simply loading in my GLB files wrong? If so, how should I load them in?

If not, I suspect this has to do with line 1876 of glTFLoader.ts. Comments say it should be

babylonTexture.updateURL(dataUrl, new Blob([data], { type: image.mimeType }));

instead of

babylonTexture.updateURL(dataUrl, data);

unless there’s something I’m completely missing.

ping @bghgary and @syntheticmagus

Hi TheNotoriousEIN,

Thanks for bringing this up! We’re having trouble repro-ing this issue on our side; our tests are passing, and the Playground and sandbox seem to be working properly for us with GLBs. Can you tell us more about the version you’re using (latest commit, etc.) and check that everything is in sync?

(Regarding the commit and comments you referenced, those comments were put in before we decided to, instead, change updateURL to be able to accept ArrayBufferViews. The new approach was the reason for all the places where we added ArrayBufferView to the list of types accepted by various methods. We might have missed something in the process, but that was the thinking behind that change.)

Hi syntheticmagus.

So before, I was grabbing the babylon and babylon loader library as so:

<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script>

in my index.html.

When I installed the library through npm, everything seemed fine.

How do I check what version exactly I am on? And that everything is in sync.

And thanks for the information, it seems to mostly be on my end then.

You are taking one from cdn (so stable version) and the other from preview:)

Pick both from preview.babylonjs.com and you will be fine