Asynchronous Screenshot saving?

Hi all,

I’m aware of this:

But, upon downloading the most recent SDK, it seems not to have been added for production-usage, since whenever I try the referenced methods, I get bugs like these:

AttributeError: 'panda3d.core.GraphicsWindow' object has no attribute 'save_async_screenshot'

Trying to call screenshot/saveScreenshot from an asychronous task leads to this error:

:display:wgldisplay(error): Failed to make WGL context current.

So how would one go about getting and saving a screenshot of the application asynchronously without encountering such errors?

Thanks in advance.

I suppose that my question is this: Does the taking of the screenshot–before you attempt to save it to disk–prove to be too slow for your application?

Because if that part is fast enough when done synchronously, then you could perhaps handle just the saving of the file asynchronously, I imagine.

(Which latter can, I think, be done by creating a thread-class, providing it with the screenshot as a Texture, and then within the thread-class’s “run” method, calling that Texture’s “write” method.)

Are you aware of the Panda screen recorder made by Simulan? It appears to do what you’re hoping for: Panda3d-screenrecorder Easy Realtime Video Encoding from Panda3D - Panda Features in Development - Panda3D

Thanks for the suggestion, it did the trick! I got the screenshot from the main thread as a texture and then saved it on an asynchronous task. This isn’t too noticeable from a speed perspective so it’ll have to do for now.

1 Like

Hi, that’s a cool tool, but it’s not what I’m looking for specifically.

You can also use a development build of Panda 1.11:
https://buildbot.panda3d.org/downloads/d9052bae763ac42d0bf1d678be7206b20f7e46f8/

1 Like