[vtkusers] rendering into a render window from multiple threads

Lars Friedrich Lars lars-friedrich at gmx.net
Tue Sep 28 18:22:24 EDT 2010


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threading.cxx
Type: text/x-c++src
Size: 4001 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100929/9e4c2d6b/attachment.cxx>
-------------- next part --------------
PROJECT (Cone)

FIND_PACKAGE(VTK)
IF(VTK_FOUND) 
        INCLUDE(${VTK_USE_FILE}) 
ELSE(VTK_FOUND)
        MESSAGE(FATAL_ERROR "Cannot build nReg2D3D without VTK (NOTE: GLSL-enabled VTK >= 5.5. Please set VTK_DIR.")
ENDIF(VTK_FOUND)

ADD_EXECUTABLE(
threading
threading.cxx
)

TARGET_LINK_LIBRARIES(
threading
vtkRendering 
vtkCommon
)


More information about the vtkusers mailing list