How to render on a server and view on client?

I want to do all the rendering on the server and stream the captured graphics to the client(s).
I know its very hardware-demanding and propably too slow to be very useful.
I propably have to render to a texture-buffer capture each frame and send it to a socket then recieve the frame and put it on a screen-filling plane.

So the main question is:
How can i capture those frames (or better a video-stream)?

You can capture the frames the same way you would capture them and save them to disk. You can either call buffer.getScreenshot() each frame to capture them to a PNMImage, which is especially slow; or you can create the buffer with makeTextureBuffer() and toRam = True, so that it is automatically copied to the CPU and is available (as a raw RGBA image array) as tex.getRamImage(), which is also slow but not quite as slow as buffer.getScreenshot().

You’ll then have to send the frames to your client yourself. Encoding the frames into a video stream would be a separate process that would probably take more time than it would save, unless you have a particularly slow network connection and/or a dedicated video-encoding card.


As the normal standard-library sockets are no ostreams and i dont get how to use pointer to the char-array in python to make a string i propably have to use pandas builtin networking or save the pnmimage to disc and read it in again as a string which is not so fast.
In the networking-part of the manual there are only datagrams and no streams as far as i understand.
Is there any documentation or even tutorial on using stream/TCP-connections with pandas networking?

How can i write the image to a (TCP/Stream) socket without saving to disc?

Next step would be reading…

Next step would be reading, indeed.

There are many examples of using Panda’s networking, as well as Python native sockets. Try searching the forums. You don’t need to use a C-style char array; Panda’s networking and Python sockets both work perfectly with Python strings, which is what you can get out of a PNMImage or out of texture.getRamImage().