[Interest] Attribute Qt::AA_UseOpenGLES must be set before QCoreApplication is created.
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Fri Oct 18 11:44:34 CEST 2019
Il 18/10/19 11:28, Thomas Sevaldrud ha scritto:
> I doesn't actually appear to have any negative consequences. Everything
> works as before, but our users are complaining about the warning :)
>
> The reason that these attributes are set after creating the QApplication
> is that I have a fallback system where I can try for software rendering
> if the ANGLE setup fails for some reason (crappy drivers, etc). So if my
> GLContext with AA_UseOpenGLES fails, I try again with
> AA_UseSoftwareOpenGL. This also appears to work nicely.
The principle is that once Qt "thinks" you are using Desktop GL, setting
that attribute may or may not make it switch over to ANGLE, and vice
versa. In other words there comes a point in time after which setting
the attribute becomes meaningless (in the specific case: typically after
the first GL context has been created, but this is undocumented and
should not be relied upon).
What Qt is warning about is that you're touching a setting that may or
may not have any effect (depending on the OS, what you did so far in the
application, which modules of Qt you're using, the day of the week, the
moon phase), so don't it.
What you could maybe do is to create a Q(Gui)Application, do your tests
to detect which GL way to use, and if you need to switch to ANGLE or
software then
1) destroy the QGuiApplication object
2) set all the attributes you need
3) create QGuiApplication again and proceed
(Or, similarly: save some settings and restart the application with the
new settings)
> I don't actually use the QApplication for anything, I'm only using Qt as
> a GL wrapper with no QML, Gui, Network or anything. So I tried to simply
> remove the QGuiApplication, but then it crashes during
> QOpenGLContext::create(), so I guess it needs to exist after all.
Touching any and I mean any GUI class requires a QGuiApplication object,
anything else is not supported (and will likely crash).
HTH,
--
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191018/61185db3/attachment.bin>
More information about the Interest
mailing list