[vtkusers] MakeCurrent() problem when picking

刘文博 leo.liuwb at gmail.com
Tue Jan 29 05:04:35 EST 2013


Dear all,

I'm writing an DICOM image viewer that could display pixel intensity when
the mouse moving over the image.

During the picking, I got this error information "ERROR: In
..\..\VTK_src\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 225
vtkWin32OpenGLRenderWindow (0CF6B6F8): Attempting to call MakeCurrent for a
different window than the one doing the picking, this can causes crashes
and/or bad pick results
"
And then everything in the viewer disappeared.

I use vtkResliceImageViewer for image display and MPR, here are the
relative codes:

vtkRenderer * pRender = m_pResliceImageViewer->GetRenderer( m_nWidgetIndex
);
int nCode = 0;
nCode = GetInteractor()->GetPicker()->Pick( dEventPos[0], dEventPos[1], 0,
pRender );
    if ( 0 == nCode )
    {
        return ERROR_VALUE_INVALID;
    }
GetInteractor()->GetPicker()->GetPickPosition( m_dCurrentPositionWorld );

FYI, this problem occured by chance. Moving mouse over the image very fast,
or moving mouse over   multiple actors may increase the probability of
occurrence. I tried to call renderwindow->MakeCurrent() every time before
picking, but the problem still existed. I guess this may be caused because
of the multithreading, but I have no idea how to fix it.

This problem bother me a lot for several days, I really appriciate if you
could help me with it.
Thanks a lot!

Best,
Wenbo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130129/19cfa088/attachment.htm>


More information about the vtkusers mailing list