[vtkusers] vtkContextView with QVTKOpenGLWidget - SetRenderWindow / update data

gde23 gdeee at web.de
Mon Jan 22 12:55:02 EST 2018


Hi,

i want to render a vtkContextView inside a QVTKOpenGLWidget
For this i have a function that takes some points and plots them

void plot::ScatterPolt2D(vtkSmartPointer<vtkTable> inputData, std::string
&unit, double pv_val)
{
    vtkNew<vtkContextView> contextView;

    vtkNew<vtkChartXY> chart;
    contextView->GetScene()->AddItem(chart);

    vtkSmartPointer<vtkPlot> points = chart->AddPlot(vtkChart::POINTS);
    points->SetInputData(inputData, 0, 1);

    contextView->SetRenderWindow(m_vtk_widget->GetRenderWindow());
    m_vtk_widget->GetRenderWindow()->Render();
}

however when i try to update the data (and call the function again) the
program crashes

I guess because of some memory corruption with a not released smartPointer
probabely from here??

contextView->SetRenderWindow(m_vtk_widget->GetRenderWindow());





--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list