Qt3D Clipping my viewport to bottom left quadrant of window
-
Using Mac version...
I'm displaying objects in a QGLView window and I cannot get the viewport to match the window size. It keeps drawing all my object in bottom left quadrant of the screen.
Resizing has no effect. Actually, when I implement resizeGL is does not even get called?
@
void CubeView::paintGL(QGLPainter *painter)
{
painter->setStandardEffect(QGL::LitMaterial);
painter->setFaceColor(QGL::AllFaces, QColor(170, 202, 0));// Draw the set of objects in the scene. if ( !vdm.isEmpty()) { // Need to traverse all the SceneNodes and draw them... foreach( VisualDataModel *VisualDataItem, vdm ) { VisualDataItem->getNode()->draw(painter); } }
}
@ -
So reading bugs... I'm guessing this is related to hiDPI support for Mac since window is 2x viewport dimensions? Should I be using Qt3D / OpenGL on Mac with Retina Display?
Changing display resolution does not seem to help.
-
I found a workaround - in qglwindowsurface.cpp modify the function QRect QGLWindowSurface::viewportGL() const, changing the return statement to:
@
return QRect(0,0,geom.width() * window()->devicePixelRatio(), geom.height() * window()->devicePixelRatio());
@
Multiplying by devicePixelRatio handles scaling by two - should work on other platforms as well but I haven't tested it.