diff options
Diffstat (limited to 'examples/opengl')
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.cpp | 7 | ||||
-rw-r--r-- | examples/opengl/hellowindow/hellowindow.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp index 6de48e8c95..b0576c1255 100644 --- a/examples/opengl/hellowindow/hellowindow.cpp +++ b/examples/opengl/hellowindow/hellowindow.cpp @@ -34,6 +34,13 @@ void HelloWindow::mousePressEvent(QMouseEvent *) updateColor(); } +void HelloWindow::resizeEvent(QResizeEvent *) +{ + glContext()->makeCurrent(); + + glViewport(0, 0, geometry().width(), geometry().height()); +} + void HelloWindow::updateColor() { float colors[][4] = diff --git a/examples/opengl/hellowindow/hellowindow.h b/examples/opengl/hellowindow/hellowindow.h index b0adecbb10..f0b8ee8b45 100644 --- a/examples/opengl/hellowindow/hellowindow.h +++ b/examples/opengl/hellowindow/hellowindow.h @@ -13,6 +13,7 @@ public: protected: void mousePressEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); private slots: void render(); |