Gltf import in C++

  1. I know that there is a module to import GLB files to Panda3D in Python, but is there a way to do it in C++? I can’t find it.
  2. When I load a model (I use Visual Studio 2022), my application thinks that it (application) is located in x64/Debug and not in source code directory. I need to make it think that it is in the directory of the source code. How can I do it?

It looks like you’ve encountered an ambiguity in Panda3D. The support of the side that uses Python is more significant than C++. This question can be fully answered by @rdb and @Moguri.

I think you will have to use the Assimp module with its disadvantages or egg and bam.

Thanks for your answer.
One more problem: I can’t use Assimp. I think it is because my Panda’s version is 1.11.0. But I can use exporter to get my model in .bam format. And what about problem №2 (I have edited my question)? Maybe you know how I can fix it?
P. S.: my texts can be strange because English is not my strong point.

I also have no knowledge of English, except for technical terms and so on, so this is not a problem here.

There is a variable in the configuration file for searching assets, you can add paths at your discretion.

etc/Config.prc

model-path    $MAIN_DIR
model-path    $THIS_PRC_DIR/..
model-path    $THIS_PRC_DIR/../models
1 Like

Thank you a lot! This solution (editing of Config.prc) works.

You can use assimp to load glTF if you set this in Config.prc:

assimp-disable-extensions

By default this variable is set to “glb gltf” in 1.11, by setting it to empty you can re-enable the loading of glTF files.

However I rather suggest just using panda3d-gltf to convert your model to .bam offline.

1 Like