[vtkusers] bug in vtkOpenGLRenderer::StartPick

Jeff Lee jeff at cdnorthamerica.com
Fri Feb 15 09:09:54 EST 2002


Oops, forgot to leave attatchment..

I agree, this is a problem if you don't call Render() in the picked 
window before you make the pick because in your case, the old glContext 
is being used in StartPick. A simple workaround is to call Render on the 
renderWindow from which you are picking, but I think to be safe, that a 
MakeCurrent() should be called in vtkOpenGLRenderer::StartPick(). What 
do you think, Ken?
-Jeff

    This is a trace of the messages that are called before I believe
    offending openGL calls are made in StartPick(). Read from bottom to
    top:

    vtkOpenGLRenderer::StartPick(unsigned int 1555) line 239
    vtkRenderer::PickProp(float 135.000, float 247.000) line 1190 + 26
    bytes
    vtkViewport::PickPropFrom(float 135.000, float 247.000,
    vtkPropCollection * 0x00000000) line 629 + 24 bytes
    vtkPropPicker::PickProp(float 135.000, float 247.000, vtkRenderer *
    0x05b8b688) line 105 + 26 bytes
    vtkPropPicker::Pick(float 135.000, float 247.000, float 0.000000,
    vtkRenderer * 0x05b8b688) line 73

    I call the vtkPropPicker::Pick() operation from an
    OnLeftButtonDown() message. There are multiple 2D actors in the
    scene. Unless, you are using vtk2DActors and the vtkPropPicker you
    will not necessarily? enter this method at least I do not enter this
    method when I do a cell pick operation.

    StartPick() makes openGL calls such as:

    this->PickInfo->PickBuffer = new GLuint[bufferSize];
    glSelectBuffer(bufferSize, this->PickInfo->PickBuffer);
    // change to selection mode
    (void)glRenderMode(GL_SELECT);
    // initialize the pick names and add a 0 name, for no pick
    glInitNames();
    glPushName(0);

    I think there needs to be a MakeCurrent() here before these calls
    are made. As you see, none of the functions before StartPick() call
    MakeCurrent(). Even if your code wasn't crashing, wouldn't you make
    your gl context current before making these calls? I have done this
    in my renderer and it works better.

>     From: Jeff Lee <jeff at cdnorthamerica.com>
>     To: Anthony Sherbondy <sherbond at stanford.edu>
>     CC: vtkusers at public.kitware.com
>     Subject: Re: [vtkusers] small bug in startpick() method
>     Date: Thu, 14 Feb 2002 17:04:07 -0500
>
>     If you could provide some code which demonstrates a problem, that
>     would
>     be good, I use multiple renderers all the time and picking works
>     great.
>     What is your problem specifically?
>     -Jeff
>
>     Anthony Sherbondy wrote:
>
>>     Hello,
>>
>>     The startpick() method in vtkOpenGLRenderer does not call
>>     MakeCurrent()
>>     before accessing openGL. I believe this is a bug as it seems to
>>     cause me
>>     many problems when I attempt to interact with multiple windows.
>>     If I add
>>     MakeCurrent() at the beginning of this function there is no problem.
>>
>>     -Tony
>>
>>     _______________________________________________
>>     This is the private VTK discussion list.
>>     Please keep messages on-topic. Check the FAQ at:
>>     <http://public.kitware.com/cgi-bin/vtkfaq>
>>     Follow this link to subscribe/unsubscribe:
>>     http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
>     _______________________________________________
>     This is the private VTK discussion list.
>     Please keep messages on-topic. Check the FAQ at:
>     <http://public.kitware.com/cgi-bin/vtkfaq>
>     Follow this link to subscribe/unsubscribe:
>     http://public.kitware.com/mailman/listinfo/vtkusers



    _________________________________________________________________
    Join the world's largest e-mail service with MSN Hotmail.
    http://www.hotmail.com

    _______________________________________________
    This is the private VTK discussion list. Please keep messages
    on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
    Follow this link to subscribe/unsubscribe:
    http://public.kitware.com/mailman/listinfo/vtkusers





More information about the vtkusers mailing list