From 7a85fccb8fd104bf5e5d839358afb049863768ab Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 15 May 2013 19:34:02 +0200 Subject: Update opengl/overpainting example for high-dpi Depends on I8e81a0c6af61df1c4497a5934e2b89bad6f616f0 to properly render the overlay. Change-Id: I7ef6b726cc06eb750e7c00beb4ec6e80e85866a1 Reviewed-by: Gunnar Sletta --- examples/opengl/overpainting/glwidget.cpp | 6 ++++-- 1 file 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] -- cgit v1.2.3