[vtkusers] Facing problems with rendering and multi-threading

Rajesh K Rajesh_K at mindtree.com
Mon Aug 21 12:06:13 EDT 2006


I have a VC++ program that has two threads, one of which creates a window
(vtkWin32OpenGLRenderWindow) and runs the message loop for the same.

Another thread reads volumes on some command and then renders it in the same
window (created by the first thread) creating a new renderer. This logic was
working fine with VTK 4.2.

Recently, I had got upgraded to VTK 4.4, after that the same algorithm
started giving the error 170  (i.e The requested resource is in use -
ERROR_BUSY) in the AddRenderer Call (Internally it was failing in

So, I tried creating a new rendering context using the following code before
calling the AddRenderer.

HDC    hdc; 
HGLRC  hglrc,oldhglrc;

HWND hwnd = pCVtkCommonGUI->renWin->GetWindowId();

hdc = GetDC(hwnd); 
HDC oldhdc = (HDC)pCVtkCommonGUI->renWin->GetGenericContext();
int pixelid = GetPixelFormat(oldhdc);
DescribePixelFormat(oldhdc, pixelid, 
        sizeof(PIXELFORMATDESCRIPTOR), &pfd); 

int iPixelFormat = ChoosePixelFormat(oldhdc, &pfd);
SetPixelFormat(hdc, iPixelFormat, &pfd);

oldhglrc = (HGLRC)pCVtkCommonGUI->renWin->GetGenericDisplayId();
// create a rendering context 
hglrc = wglCreateContext (hdc);

Now the ERROR_BUSY is not occurring, but my interactor stopped working. 

Can anybody explain what could be the reason for this behavior and what would
be the remedy?

Thanks in advance.

Rajesh K
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060821/4807ccc3/attachment.txt>

More information about the vtkusers mailing list