Qt 5.3 vs. 4.8 GL rendering size problem
-
I render a 3D scene in the main window of my app. In Qt 4.8 it works as intended. With everything else the same, in Qt 5.3 the rendered contents of the window are much smaller than the window and pinned to the bottom-left. The area occupied by the rendering is less than 1/4 of the width and height of the window they are drawn in. But only in Qt 5.3, not 4.8. I'm poking around trying to figure out what I might be setting wrong, but, of course, since it works in 4.8, I'm not finding anything. Has anyone else heard of or hit this themselves? Any suggestions for finding and fixing the root cause?
-
Hmm, I haven't seen this (I started using Qt around 5.1, I believe), so here are a few questions:
- Are you drawing in a QWindow, QGLWidget, or something else?
- Are you using raw OpenGL or Qt's convenience classes?
- Do you call glViewport when rendering?
Off the top of my mind, those would be the most likely leads to narrow down the issue, but I'm no pro at this...
-
Since you didn't start until 5.x, you wouldn't have seen this, I think. I know I tried 5.2 at one point, and it had this problem. It persists into 5.3. Qt 4.8 continues to work fine.
bq. Are you drawing in a QWindow, QGLWidget, or something else?
QGLWidget.
bq. Are you using raw OpenGL or Qt’s convenience classes?
Almost all OpenGL, but I did note a few uses of qglColor() and qglClearColor() intermixed with the standard gl*() calls.
bq. Do you call glViewport when rendering?
Yes. And I checked the width and height parameters being used, at least at one level. Of course, it's unlikely my local parameters are being set wrong, else the problem would manifest in Qt 4.8. I wonder if those calls to qgl*Color() are causing a problem in 5.3, because some internal state is never set up. I don't hold out high hopes, but it's easy to test.