Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

2D vtk Renders in QT



  • I am unable to do 2D vtk renders in QT without having override errors: https://forum.qt.io/topic/104344/can-t-use-vtk-charts-in-qt-no-override-found-for-vtkcontextdevice2d

    While trying to solve this I have been reading about the vtkContextView and vtkGenericOpenGLRenderWindow classes.

    vtkGenericOpenGLRenderWindow:
    "vtkGenericOpenGLRenderWindow provides a skeleton for implementing a render window using one's own OpenGL context and drawable. To be effective, one must register an observer for WindowMakeCurrentEvent, WindowIsCurrentEvent and WindowFrameEvent."

    vtkContextView:
    "This class is derived from vtkRenderViewBase and provides a view of a vtkContextScene, with a default interactor style, renderer etc. It is the simplest way to create a vtkRenderWindow and display a 2D scene inside of it."

    I do not understand how the vtkContextView works with OpenGL and was wondering if someone could help explain their relation to one another, and how the context view works. Also, is there any other way to do 2D vtk renders without the using the context view? I cannot find any exmaples of 2D vtk renders in QT, any advice on how to do 2D renders of vtk in QT will be greatly appreciated.

    Current Attempt to render 2D vtk chart:
    vtkNew<vtkGenericOpenGLRenderWindow> renderWindowRight;
    view->SetRenderWindow(renderWindowRight);
    this->qvtkWidgetRight->SetRenderWindow(renderWindowRight);

    Additional Code in main file:
    QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());

    Additional Info: Win64 on 64bit machine, vtk8.2.0, Qt5.13.0, compiled/built in MCVS2017(Release x64) with cmake3.15.0


Log in to reply