Multi threaded rendering



Hi,

I have written a multi-threaded motif app. The main thread creates the
user interface (just a few windows) and runs event processing as
usual. For each opened window there is one rendering thread, which
creates an opengl context through which it renders to its window.

window1 <--- ogl context1 <-- thread1

window2 <--- ogl context2 <-- thread2

......


Everything works fine (even on smp systems) as long as I create only
two windows. If I try to create a third window I get a crash with the
following message:

.../../../src/mesa/glapi/glapi.c:341: _glapi_get_dispatch: Assertion
`api != ((void *)0)' failed.

The crash happens in glXMakeCurrent() when the thread attemps to make
the created context the current context.

The very same multi-threading model works fine also on windows and mac
os x. Also if I replace opengl rendering with Xlib rendering, then I
can open any number of windows and it works rock solid.

So it seems this is an linux opengl specific issue.

I have googled with the above error message but haven't found anything
useful Instead, I found a few comments which suggested not to use
more than one rendering thread.

Anyway, all the docs say that glXMakeCurrent makes the context the
current context of the thread, so I don't think they added the "thread"
comment to the docs just for fun.

Has anyone tried to create opengl contexts from more one threads? Is
it even supposed to work?

All info on this would be highly appreciated.

Thanks!

.



Relevant Pages

  • Re: listing to a file
    ... batch file but I cannot remember where I found it. ... To create the entry in the context menu it's necessary to first create a ... Save the file in your WINDOWS folder as shown in, ... File Listing will probably be most useful, but you can name yours something ...
    (microsoft.public.windowsxp.general)
  • Win Explorer Context Menu Queue it up, Add to Playlist NOT WORK
    ... During all this year by now I noticed one big problem with Windows ... Windows Explorer Right click Context menu on multimedia files (e.g. .mp3, ... In the first, I was thinking that maybe some WMP Plug-in, or Visualizations ... start to install more Software on it. ...
    (microsoft.public.windowsmedia.player)
  • Re: Right Click Crashes Windows Explorer
    ... Wondering why troubleshooting using ShellExView did not isolate the ... Apparently by doing this I insured that PowerDesk's Context Menus load ... What about other shell extensions (not only Context Menu handlers). ... see if the Event Viewer provides any clue on the Windows ...
    (microsoft.public.windows.vista.installation_setup)
  • Re: The basics of Windows messages
    ... When the receiver next calls GetMessageor PeekMessage, Windows will note that there is a sent message pending, and it will route it to the traget window before fetching the next message from the queue. ... My confusion comes mainly from the fact that the documentation for those facilities usually state that they make the calling thread yield "execution so the operating system can process other events." ... does the code in /ProcessMessages/ actually cause a switching of the execution context? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: left click is bringing up context menu
    ... 2004 Windows MVP "Winny" Award ... the context menu never gets corrected. ... >> have tried restoring to a previous day's restore point. ... >> Here's the .reg file I was talking about: ...
    (microsoft.public.windowsxp.general)