Sharing surfaces bu two or more processes

Hi everyone!
First of all, I need to thank authors of SDL, as this is an awesome library!

But I have a question… In my project I must use several processes. The main process is making a window, or initializes a fullscreen surface. Other processes may load some images, and want to blit them to the main surface.
Is it possible at all? If it is, give me some clue, please. May be memory sharing of some sort must I implement?

By the way, I must do it in Windows and Linux as well.

Really appreciate your help, guys!

This is outside the scope of SDL proper, but you could create shared memory
for the pixels, and use SDL_CreateSurfaceFrom() to create a surface from
that memory that dynamically updates. You’ll need to manage locking
between your processes to make sure that the surface isn’t being used in a
blit while the memory is being updated by another process.

Look for mitshm on Linux and CreateFileMapping() on Windows:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366551(v=vs.85).aspx

Cheers!On Tue, Oct 30, 2012 at 9:55 AM, REVERSE wrote:

**
Hi everyone!
First of all, I need to thank authors of SDL, as this is an awesome
library!

But I have a question… In my project I must use several processes. The
main process is making a window, or initializes a fullscreen surface. Other
processes may load some images, and want to blit them to the main surface.
Is it possible at all? If it is, give me some clue, please. May be memory
sharing of some sort must I implement?

By the way, I must do it in Windows and Linux as well.

Really appreciate your help, guys!


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Message-ID: <1351616133.m2f.34672 at forums.libsdl.org>
Content-Type: text/plain; charset=“iso-8859-1”

Hi everyone!
First of all, I need to thank authors of SDL, as this is an awesome
library!

But I have a question… In my project I must use several processes. The
main process is making a window, or initializes a fullscreen surface. Other
processes may load some images, and want to blit them to the main surface.
Is it possible at all? If it is, give me some clue, please. May be memory
sharing of some sort must I implement?

By the way, I must do it in Windows and Linux as well.

Really appreciate your help, guys!

Shared memory, sockets, & pipes are available on both Windows & Linux.
Different methods are good for different usage patterns (e.g. shared
mem is good for ‘large data’, and sockets for multi-machine).> Date: Tue, 30 Oct 2012 09:55:33 -0700

From: “REVERSE”
To: sdl at lists.libsdl.org
Subject: [SDL] Sharing surfaces bu two or more processes

Thank you, Sam!