PDA

View Full Version : Confusion with OpenGL desktop and applications



r2com
27th July 2016, 17:10
I decided to run some OpenGL example, and compiler gave me error:
:-1: error: This example requires Qt to be configured with -opengl desktop

Then from here http://doc.qt.io/qt-5/configure-options.html I see that by default when you install QtCreator on Windows it is configured to use some ANGLE which runs OpenGL using the DirectX.

So I'll have to build Qt from sources myself with -opengl and ANGLE disabled correct?

If yes, then another page confuses me: http://doc.qt.io/qt-5/qtopengl-index.html why they write
Warning: This module should not be used anymore for new code. Please use the corresponding OpenGL classes in Qt GUI.

So to use a native OpenGL I need to build its desktop to utilize OpenGL, but then to build OpenGL stuff...its not recommended? or am I missing something?

Added after 8 minutes:

And as an additional question, since I have installed binary Qt 5.7, for example, if I build now any OpenGL application, does it mean that the application use DirectX9 then instead of using native OpenGL?

If yes...then how can I using my currently installed Qt 5.7 on Windows build the application which uses native OpenGL?

d_stranz
27th July 2016, 17:25
This article from the Qt documentation might explain things. (http://doc.qt.io/qt-5/windows-requirements.html) You do not have to reconfigure and rebuild Qt to use native OpenGL; there are run-time switches that let Qt choose, or to force a choice on it.

anda_skoa
27th July 2016, 17:56
So to use a native OpenGL I need to build its desktop to utilize OpenGL, but then to build OpenGL stuff...its not recommended? or am I missing something?

No, that note simply says you should not be using anything from the QOpenGL module but use the OpenGL classes of the QtGui module instead.
E.g. QOpenGLContext, or, with widgets QOpenGLWidget.



And as an additional question, since I have installed binary Qt 5.7, for example, if I build now any OpenGL application, does it mean that the application use DirectX9 then instead of using native OpenGL?

By default it is runtime detected.
If the system has proper OpenGL libraries then those are being used.
If it only has the obsolete OpenGL 1.0 libraries provided by Microsoft, it will use ANGLE.

Cheers,
_

r2com
27th July 2016, 19:59
Well I did read that page already, it says
If you installed additional OpenGL drivers from your hardware vendor, then you may want to consider using this version of OpenGL instead of ANGLE. To use OpenGL, pass the command line options -opengl desktop to the configure script.

And then it shows command:
configure -opengl desktop

But where do I enter the above command? Isn't it supposed to be entered only when you start compiling Qt 5.7?

Added after 18 minutes:

Well, I checked with OpenGL Extensions Viewer I currently have OpenGL 4.0 on my laptop.


Added after 17 minutes:

d_stranz, I just checked, the configure -opengl desktop command is only used during compile time of Qt...

So if you saying that I do not need to recompile Qt 5.7, then how can I make the OpenGl Boxes Example to run without that error?

Added after 1 14 minutes:



By default it is runtime detected.
If the system has proper OpenGL libraries then those are being used.
If it only has the obsolete OpenGL 1.0 libraries provided by Microsoft, it will use ANGLE.
_
anda_skoa, Are you sure that it is really runtime detected?

it just seems from different threads all over and also this thread https://forum.qt.io/topic/22651/opengl-qt-not-working-for-me/3 that in order to compile OpenGL application I must use Qt built with -opengl desktop setting?

And also, again, why can't I run the Boxes example then and it tells me specifically "This example requires Qt to be configured with -opengl desktop" if it is runtime detected?

anda_skoa
28th July 2016, 09:51
Hmm, maybe it only does that for the QtQuick scene graph then.
I am referring to https://blog.qt.io/blog/2014/11/27/qt-weekly-21-dynamic-opengl-implementation-loading-in-qt-5-4/

Cheers,
_