OpenGL 3.3 breaking QQuick 2
-
I am having trouble setting the version of OpenGL to use to 3.3. I have started a new "Qt Quick 2 Application (Built-in Elements)" from Qt Creator and sub-classed the QtQuick2ApplicationViewer so that I can set the QSurfaceFormat as so:
@ QSurfaceFormat format;
format.setMajorVersion(3);
format.setMajorVersion(3);
format.setStencilBufferSize(4);
format.setProfile(QSurfaceFormat::CompatibilityProfile);setFormat(format);@
If I run the application nothing is rendered to the window. However, if I change the version to 3.2 or 4.0 then everything seems to render properly. My dev machine is running Ubuntu 13.04 and glxinfo reports:
bq. OpenGL version string: 4.3.0 NVIDIA 313.30
I was wondering if anyone could reproduce this in case it is a bug or shed some light on this in case there is something I am missing.
Thanks!
-
Hi and welcome to devnet,
This might be a too low-level question for this forum (it's more user oriented) You should try asking on the mailing list, you'll find Qt's developer/maintainers there.
-
Hmm, that should work. Have you tried something like this?
@
QSurfaceFormat f = format();
f.setVersion(3, 3);
f.setProfile(QSurfaceFormat::CompatibilityProfile);
setFormat(f);
@i.e. only changing the parts of the format that you need to change. You are correct in that at present QQ2 requires a compatibility profile. However, OpenGL 3.3 should work fine. I use that here with QQ2 quite a lot. Are you doing any custom OpenGL rendering? If so, try disabling that for now and just using a custom context.
-
Good stuff! Just watch out if you ever port to OS X as there you can only get OpenGL 3.2 Core profile, not compatibility, which won't work with QtQuick2 (yet). So you'd need to fall back to OpenGL 2.1 there. Hopefully we'll get the QtQuick 2 renderer working with the Core profile for Qt 5.2.