[Interest] Attribute Qt::AA_UseOpenGLES must be set before QCoreApplication is created.

Thomas Sevaldrud thomas at silentwings.no
Sat Oct 19 12:32:26 CEST 2019


On Fri, Oct 18, 2019 at 11:47 AM Giuseppe D'Angelo via Interest <
interest at qt-project.org> wrote:

> 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).
>

OK, in my case I switch these settings to software if the
GLContext::create() call fails, so I guess that's why it works. I
understand that I can't rely upon it working in the future though :-)

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)
>

Then I think I'll try deleting and recreating the GuiApplication.

 Thanks so much for your help!

- Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191019/5786e689/attachment.html>


More information about the Interest mailing list