[vtkusers] rendering into a render window from multiple threads

Lars Friedrich Lars lars-friedrich at gmx.net
Fri Oct 1 09:48:14 EDT 2010


OK, it works now (see attachment). Maybe there are other people out there who are interested in this topic ...
An initial render call in the main thread, followed by "unbinding" the GL context seems to do the trick (windows, multi-threaded off-screen rendering).

lars


-------- Original-Nachricht --------
> Datum: Wed, 29 Sep 2010 00:22:24 +0200
> Von: "Lars Friedrich Lars" <lars-friedrich at gmx.net>
> An: vtkusers at vtk.org
> Betreff: [vtkusers] rendering into a render window from multiple threads

> Hello,
> 
> I am currently trying to render into a render window from multiple threads
> (on Linux and Windows). The main issue with concurrent threads rendering
> into a common window is that we have to make sure that the context is
> current to exactly one thread. This can easily be achieved by 'mutexing' the
> render call, and making the context non-current immediately after rendering.
> Using X, we need the Xlib support for concurrent threads, i.e. calling
> XInitThreads() at the very beginning.
> 
> In principle, this approach works fine. I added a minimal example. If the
> application is called with or without "-os" (off-screen-rendering) option
> on linux (kubuntu), it works. If the app is called without "-os" option on
> windows (XP, Vista), it works, too. However, if the app is called with "-os"
> option on windows, it crashes:
> 
> "... wglMakeCurrent failed in MakeCurrent() ..."
> 
> 
> Obviously, the line
> 
> wglMakeCurrent((HDC__*)renWin->GetGenericDisplayId(), NULL);
> 
> does not work, if off-screen rendering is activated on windows.
> 
> 
> Does someone know why it does not work / does someone know a solution or
> workaround?
> 
> Thank you!
> 
> regards,
> 
> lars
> 
> 
> -- 
> Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
> Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threading_ok.cxx
Type: application/octet-stream
Size: 4271 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101001/c17daf9a/attachment.obj>


More information about the vtkusers mailing list