summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-05-15 19:34:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-23 12:49:39 +0200
commit7a85fccb8fd104bf5e5d839358afb049863768ab (patch)
tree048aee88c0130cd8f732a08b81f62ca8f4fc705b /examples
parent27f68818c85dfe615df24cf1baa0087f9d863532 (diff)
Update opengl/overpainting example for high-dpi
Depends on I8e81a0c6af61df1c4497a5934e2b89bad6f616f0 to properly render the overlay. Change-Id: I7ef6b726cc06eb750e7c00beb4ec6e80e85866a1 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'examples')
-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]