[vtkusers] black window with qvtkopenGLWidget and vtkHardwareSelector / cell picking from screen

Geoff Woodcock geoff.woodcock at velo3d.com
Sat May 12 23:22:08 EDT 2018


Hi,

I am new to VTK. My company is trying to develop a visualization program around VTK. We are using VTK 8.1 with Qt.

I am trying to do cell selection using vtkHardwareSelector. I have an InteractorStyle that is a subclass of vtkInteractorStyleRubberBandPick.

Seemingly at random when picking, the entire screen goes black, including not just the 3d view but the entire QT window including the menu bar.

It appears to happen only after I create the second InteractorStyle.

A possibly related problem is that I can't seem to call Delete() on the vtkHardwareSelector. Doing so causes an exception to occur, but not at the point of the Delete call - somewhere later in the function.

We are using vtk in a static library and I wonder if that is the cause. (Is there any way to debug the black screen?)

I have also tried doing:

VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);

And

            auto defaultFormat = QVTKOpenGLWidget::defaultFormat();
            defaultFormat.setSamples(0);
            QSurfaceFormat::setDefaultFormat(defaultFormat);

In main before I do anything else, but does not seem to have any effect.

Here is the snippet from my OnLeftButtonUp that deals with vtkHardwareSelector:

           vtkSmartPointer<vtkHardwareSelector> selector = vtkSmartPointer<vtkHardwareSelector>::New();

            selector->SetRenderer(this->CurrentRenderer);
            unsigned int windowSize[4];

            windowSize[0] = StartPosition[0] < EndPosition[0] ? StartPosition[0] : EndPosition[0]; // xmin
            windowSize[1] = StartPosition[1] < EndPosition[1] ? StartPosition[1] : EndPosition[1]; // ymin
            windowSize[2] = StartPosition[0] < EndPosition[0] ? EndPosition[0] : StartPosition[0]; // xmax
            windowSize[3] = StartPosition[1] < EndPosition[1] ? EndPosition[1] : StartPosition[1]; // ymax

            selector->SetArea(windowSize);
            selector->SetFieldAssociation(vtkDataObject::FIELD_ASSOCIATION_CELLS);
            selector->CaptureBuffers();

            mainWindow()->renderWindow()->OffScreenRenderingOn();

            vtkSmartPointer<vtkSelection> selection = selector->Select();
            selector->ClearBuffers();

            mainWindow()->renderWindow()->OffScreenRenderingOff();
            selector->Delete();  // I have to comment this out to avoid exceptions. Why???

(Exception occurs when the close brace on this code block is hit...)

Any help very much appreciated! I am new to this and have been banging my head against it for a week!

-Geoff
CONFIDENTIALITY NOTICE:This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited

CONFIDENTIALITY NOTICE:This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited
CONFIDENTIALITY NOTICE:This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180513/6978c093/attachment.html>


More information about the vtkusers mailing list