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

2019-10-19 Thread Thomas Sevaldrud
On Fri, Oct 18, 2019 at 11:47 AM Giuseppe D'Angelo via Interest <
interest@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
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


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

2019-10-18 Thread Giuseppe D'Angelo via Interest

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.dang...@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



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


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

2019-10-18 Thread Thomas Sevaldrud
Hi,

I have a Windows WPF/C# application that uses ANGLE/OpenGL through Qt. This
works nicely and has done so for many years. However, some time around 5.12
I started getting this warning when setting up my OpenGL context:

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

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.

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.

So my question is basically why this warning was introduced? Are there any
consequences here that I just haven't noticed yet? Is there a way to
disable this warning through QLoggingCategory::setFilterRules or something?

Cheers,
Thomas
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest