How to add 3D GLTF Model to MapBox?

Hello everybody,

What I am trying to do:

I am trying to use mapbox in my app. So far everything works fine but now I want to load a gltf model with three.js on my map. I followed along the example here:

MapBox GLTFLoader Example

Whats my problem:

Since I a have not that much experince with javascript I have problems converting the code from the example to python. These are my questions:

  • On the optional “onAdd” function in the custom Layer they create a function in the dictionary. How can I do the same in my python script or do I have to define a function and use it?
  • In that function they use the created “map” and the “gl context” as parameters. I can´t figure out where they get the gl context from. Can somebody help me?
  • The same goes with the “render” function, where I have no clue where they get the matrix from.

Thanks in advance for any help!

Best Regards

Thomas