[vtkusers] Setting render window on a vtkContextView

Ben Medina ben.medina at gmail.com
Thu Sep 9 19:29:28 EDT 2010


Hello all,

I'm working with a vtkContextView in a QVTKWidget. For uniformity with
other code, I'd like to set the render window on the vtkContextView to
be the render window from the widget. Here's an example:

#include <QApplication>
#include <QVTKWidget.h>
#include <vtkContextView.h>
#include <vtkSmartPointer.h>

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);
    QVTKWidget vtkWidget;
    vtkSmartPointer<vtkContextView> context =
vtkSmartPointer<vtkContextView>::New();

    context->SetRenderWindow(vtkWidget.GetRenderWindow());
    //vtkWidget.SetRenderWindow(context->GetRenderWindow());

    vtkWidget.show();

    return app.exec();
}

This crashes down in a vtkSmartPointBase destructor. If I do this the
other way around (as in the commented-out code), it's successful. Does
anyone know what's going wrong?

Thanks,
Ben



More information about the vtkusers mailing list