Slow resize of vtkContextView (on Win 10)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Slow resize of vtkContextView (on Win 10)

Elvis Stansvik
Hi all,

As I was debugging DPI issues on Windows today, I noticed an unrelated thing.

Resizing a vtkContextView (in this case, containing a vtkChartXY) is
very (!) slow.

See the following screen recording where I resize the window:

    https://drive.google.com/open?id=1pOKuDjT4IwE54xIRQoYni5-A2PUeZtbL

The recording itself makes it look a little worse than it is, but it's
not far off from the actual experience.

This was on Win 10, with VTK 8.1.1, OpenGL 2 backend, Qt 5.11.1. The
vtkContextView was in a QVTKOpenGLWidget.

I know that accomplishing smooth resizing of GL windows is
non-trivial, but should it really be this bad? It makes it impossible
to build Qt/VTK applications that resize smoothly.

Best regards,
Elvis
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: Slow resize of vtkContextView (on Win 10)

Elvis Stansvik
I don't think the code matters much, but here it is (it was the
beginning of a test case for something else, so has some unrelated
things in it):

#include <QApplication>
#include <QSurfaceFormat>
#include <QDebug>

#include <QVTKOpenGLWidget.h>

#include <vtkRenderer.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkSmartPointer.h>
#include <vtkChartXY.h>
#include <vtkContextView.h>
#include <vtkContextScene.h>
#include <vtkTextProperty.h>
#include <vtkFreeTypeTools.h>
#include <vtkAxis.h>

int main(int argc, char *argv[])
{
    vtkFreeTypeTools::GetInstance()->ForceCompiledFontsOff();

    QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());

    QApplication app(argc, argv);

    auto window = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();

    auto widget = new QVTKOpenGLWidget();
    widget->SetRenderWindow(window);
    qDebug() << "Setting DPI to" << widget->logicalDpiX();
    window->SetDPI(widget->logicalDpiX());

    auto chart = vtkSmartPointer<vtkChartXY>::New();
    chart->AddPlot(vtkChart::LINE);
    chart->GetAxis(vtkAxis::BOTTOM)->SetVisible(false);

    for (auto axisId : { vtkAxis::LEFT, vtkAxis::BOTTOM }) {
        auto axis = chart->GetAxis(axisId);

        auto labelProperty = axis->GetLabelProperties();
        labelProperty->SetFontFamilyAsString("Tahoma");
        labelProperty->SetFontSize(8);

        auto titleProperty = axis->GetTitleProperties();
        titleProperty->SetFontFamilyAsString("Tahoma");
        titleProperty->SetFontSize(8);
    }

    auto view = vtkSmartPointer<vtkContextView>::New();
    view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
    view->SetRenderWindow(window.Get());
    view->GetScene()->AddItem(chart);

    widget->show();

    return app.exec();
}

Elvis

2018-08-25 13:01 GMT+02:00 Elvis Stansvik <[hidden email]>:

> Hi all,
>
> As I was debugging DPI issues on Windows today, I noticed an unrelated thing.
>
> Resizing a vtkContextView (in this case, containing a vtkChartXY) is
> very (!) slow.
>
> See the following screen recording where I resize the window:
>
>     https://drive.google.com/open?id=1pOKuDjT4IwE54xIRQoYni5-A2PUeZtbL
>
> The recording itself makes it look a little worse than it is, but it's
> not far off from the actual experience.
>
> This was on Win 10, with VTK 8.1.1, OpenGL 2 backend, Qt 5.11.1. The
> vtkContextView was in a QVTKOpenGLWidget.
>
> I know that accomplishing smooth resizing of GL windows is
> non-trivial, but should it really be this bad? It makes it impossible
> to build Qt/VTK applications that resize smoothly.
>
> Best regards,
> Elvis
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: Slow resize of vtkContextView (on Win 10)

Elvis Stansvik
In reply to this post by Elvis Stansvik
2018-08-25 13:01 GMT+02:00 Elvis Stansvik <[hidden email]>:

> Hi all,
>
> As I was debugging DPI issues on Windows today, I noticed an unrelated thing.
>
> Resizing a vtkContextView (in this case, containing a vtkChartXY) is
> very (!) slow.
>
> See the following screen recording where I resize the window:
>
>     https://drive.google.com/open?id=1pOKuDjT4IwE54xIRQoYni5-A2PUeZtbL
>
> The recording itself makes it look a little worse than it is, but it's
> not far off from the actual experience.
>
> This was on Win 10, with VTK 8.1.1, OpenGL 2 backend, Qt 5.11.1. The
> vtkContextView was in a QVTKOpenGLWidget.

More info: The computer was a Thinkpad X1 Carbon with Intel UHD Graphics 620.

Elvis

>
> I know that accomplishing smooth resizing of GL windows is
> non-trivial, but should it really be this bad? It makes it impossible
> to build Qt/VTK applications that resize smoothly.
>
> Best regards,
> Elvis
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtk-developers