OpenGL operates in device pixel space. For example, the width and height passed to glViewport should be in device pixels. QGLWidget::resizeGL() gives the width and height in device pixels.
However, QGLWidget::width() is really QWidget::width() which returns a value in device-independent pixels. Resolve it by multiplying with widget->windowHandle()->devicePixelRatio() if needed.
"""
Now that devicePIxelRatio is exposed by Qt we need to scale the widget width/height we pass to the shaders by it.
I haven't debugged yet, but I think this may be because of my hidpi display:
http:// blog.qt. io/blog/ 2013/04/ 25/retina- display- support- for-mac- os-ios- and-x11/
"""
QGlWidget
OpenGL operates in device pixel space. For example, the width and height passed to glViewport should be in device pixels. QGLWidget: :resizeGL( ) gives the width and height in device pixels.
However, QGLWidget::width() is really QWidget::width() which returns a value in device-independent pixels. Resolve it by multiplying with widget- >windowHandle( )->devicePixelR atio() if needed.
"""
Now that devicePIxelRatio is exposed by Qt we need to scale the widget width/height we pass to the shaders by it.