-
Notifications
You must be signed in to change notification settings - Fork 142
Please update the doc to indicate that glmatrix needs to be included for the examples to work #2817
Comments
May I suggest you remove the dist and use the glmatrix source code instead. The instructions depend on the reader being able to decompile a web pack bundle in order to understand the lesson. |
I have added GLMatrix using JSDelivr like this: <script src="https://cdn.jsdelivr.net/npm/[email protected]/gl-matrix-min.js"></script> The note in the MDN article which takes one to this issue should be before the |
Yeah I guess the |
Thanks @TomasHubelbauer -- replacing the |
None of these quite worked for me. I ended up adding In the JS I then added This got example 2 going. |
For npm users:
Then in your code: import { mat4 } from 'gl-matrix'; Optionally, get the TypeScript type definitions:
|
@Elchi3 I can take this over for you if you like. I've been working with glMatrix and WebGL a lot lately doing WebXR, so this would be pretty trivial for me to handle. |
@a2sheppy That would be so fantastic! I haven't had the time to get to this :( |
I've made some initial changes to the document to help with this problem. There was actually a mention of the glMatrix thing but not until the very end. I've submitted [a pull request](mdn/webgl-examples#29) to update this example to use a |
As sheppy says, there is a PR submitted for this now mdn/webgl-examples#29. Anyone wants to review? |
This doc is updated and I've merged the code updates, so this issue should now be completed. |
Hi,
The doc at https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Adding_2D_content_to_a_WebGL_context doesn't mention the dependency on glmatrix as an external script (except for one oblique reference to it in a comment that I saw after debugging extensively and googling about this).
As it stands, most folks will run into the issue of mat4 being undefined, which is confusing in particular because it's a type in the gl scripts. I added a script src to https://mdn.github.io/webgl-examples/tutorial/gl-matrix.js in order to resolve the dependency. I think the doc just needs to mention it more explicitly as a basic requirement for the tutorial.
Thanks,
Aaron
The text was updated successfully, but these errors were encountered: