Once I have no more use for mytexture and nothing is currently using it (e.g. I did mymodel.removeNode()), what should I do to completely clean up the particular render-to-texture setup behind it?
Unfortunatelly I didn’t get that. If I try something like base.closeWindow(mybuffer) I get the error:
...
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 650, in closeWindow
self.winList.remove(win)
ValueError: list.remove(x): x not in list
On the forum I found references to base.closeWindow only in the context of quitting the game cleanly.
Am I perhaps doing something conceptually wrong here? I wanted to have a render-to-texture created whenever a certain effect is triggered, and destroyed when the effect is done. There may be zero, one or several of these effects running at any given moment.
On the other hand… I’ve now tried this in one case where so far I reused one and the same buffer, and after a number of creations/destructions, the frame rate starts to drop off. While when I try it in a standalone toy case, creations/destructions go on indefinitely without any drop in frame rate. Is it possible that the buffer does not get removed due to some active reference, and how could I check that (like getting a list of existing buffers)?
I’ve run into this issue before, too, where a buffer seems to be hanging around longer than it should. It’s possible to track it down using Python’s existing reference-count debugging tools, but it’s tedious.
It might be easier just to re-use the same buffer every time, instead of closing and reopening buffers.