Hi everyone. I am kinda new to Panda3D and so far I love it, but I have got stuck when trying to create geometry in a separate thread. I’m making a game that creates a lot of meshes on the fly as the user is playing, using GeomVertexData and GeomVertexWriter.
Some of these on the fly creations can take up to 1/5th of a second, so it’s not acceptable for the game to be stopped during that time, it becomes too noticeable. So I thought it might be a good idea to put that in a separate thread (I’m already doing that for networking and works perfectly). So far, I haven’t been able to do it. Things I have tried so far:
- Creating the GeomVertexData and GeomVertexWriter(s) objects in the main thread and then writing data to them in a different thread. This fails because GeomVertexWriter knows who created it and doesn’t allow other threads to alter it.
- Creating the GeomVertexData and GeomVertexWriter(s) objects in the separate thread, populating the vertex data and then attaching the node for rendering. This generates a deadlock.
- Creating the GeomVertexData and GeomVertexWriter(s) objects in the separate thread, populating the vertex data and then attaching the node for rendering in the main thread. This also generates a deadlock.
I have tried with Python’s thread and threading libraries as well as those provided in direct.stdpy. So far everything leads to crashes and deadlocks. Any thoughts? Can someone provide an example of geometry creation in a separate thread?
By the way, I’m doing these tests on a 64 bit Arch Linux.
Thanks a lot in advance,