SDL Digest, Vol 49, Issue 83

Message-ID:
? ? ? ?<AANLkTimOeSGNTGYejHvweMgXdSaLuG8K_MAJ=OHPFO=9 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Ah, wait a second, since SDL_SetVideoMode() appears removed in 1.3. I
guess it was correct to have pump events in the thread that runs the
OpenGL window since that thread had brought up its own window (which
is a kind of ‘video mode’) and then got the context for OpenGL from
the thread that run SDL init (which had released it with a
SDL_GL_MakeCurrent(window, NULL);).

Which means some of the advice in the mailing list is incorrect,
implying pump events must be done on the main SDL thread.
Actually, no. The mailing list is recommending behavior that will
avoid full rewrites of your source code if you try to compile it for
another platform. In specific, the Mac platform (and probably the
IPhone platform) require all I/O operations (apparently even file
I/O!) to be done in the initial thread. As far as I’ve heard, there
isn’t any platform that requires I/O to be done outside of the main
thread, so I’d suggest that at least for graphics, you stick to the
mailing list’s advice.> Date: Wed, 19 Jan 2011 20:10:37 +0200
From: Michael Menegakis
To: SDL Development List
Subject: Re: [SDL] peeping events from a new thread

Hi,

you can’t really do graphics in multiple threads on all platforms…
especially with SDL. So stick with doing ‘pure’ functions in threads :slight_smile:

However OSX can do GL in multiple threads.

http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_threading/opengl_threading.html

I’ve done it, and it works.

I’ve also done image loading with multiple threads on OSX with no problems.

… again. Keep all non-software video output, and event stuff in the main
thread. If you’re just using software surfaces you can do things to them in
other threads and then blit them finally in the main thread.

cya!On Wed, Jan 19, 2011 at 9:26 PM, Jared Maddox wrote:

Date: Wed, 19 Jan 2011 20:10:37 +0200
From: Michael Menegakis
To: SDL Development List
Subject: Re: [SDL] peeping events from a new thread
Message-ID:
<AANLkTimOeSGNTGYejHvweMgXdSaLuG8K_MAJ=OHPFO=9 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Ah, wait a second, since SDL_SetVideoMode() appears removed in 1.3. I
guess it was correct to have pump events in the thread that runs the
OpenGL window since that thread had brought up its own window (which
is a kind of ‘video mode’) and then got the context for OpenGL from
the thread that run SDL init (which had released it with a
SDL_GL_MakeCurrent(window, NULL);).

Which means some of the advice in the mailing list is incorrect,
implying pump events must be done on the main SDL thread.
Actually, no. The mailing list is recommending behavior that will
avoid full rewrites of your source code if you try to compile it for
another platform. In specific, the Mac platform (and probably the
IPhone platform) require all I/O operations (apparently even file
I/O!) to be done in the initial thread. As far as I’ve heard, there
isn’t any platform that requires I/O to be done outside of the main
thread, so I’d suggest that at least for graphics, you stick to the
mailing list’s advice.


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