summaryrefslogtreecommitdiffstats
path: root/examples/opengl/overpainting/glwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/overpainting/glwidget.cpp')
-rw-r--r--examples/opengl/overpainting/glwidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/opengl/overpainting/glwidget.cpp b/examples/opengl/overpainting/glwidget.cpp
index 78f5f96c48..420ae3e881 100644
--- a/examples/opengl/overpainting/glwidget.cpp
+++ b/examples/opengl/overpainting/glwidget.cpp
@@ -161,7 +161,8 @@ void GLWidget::paintEvent(QPaintEvent *event)
static GLfloat lightPosition[4] = { 0.5, 5.0, 7.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
- setupViewport(width(), height());
+ qreal pixelRatio = devicePixelRatio();
+ setupViewport(width() * pixelRatio, height() * pixelRatio);
//! [6]
//! [7]
@@ -200,7 +201,8 @@ void GLWidget::paintEvent(QPaintEvent *event)
//! [11]
void GLWidget::resizeGL(int width, int height)
{
- setupViewport(width, height);
+ qreal pixelRatio = devicePixelRatio();
+ setupViewport(width*pixelRatio, height*pixelRatio);
}
//! [11]