Specifying OpenGL Desktop instead of ES for Qt5Why it is necessary to set precision for the fragment shader?OpenGL ES 2.0 texturingglTexGen in OpenGL ES 2.0Where is specified how OpenGL ES 2.0 represents float texture values in the fragment shader?OpenGL program port to Android OpenGL ES2.0OpenGl ES on iOS lightshading removes colorQOpenGLFunctions_4_3_Compatibility with QOpenGLContext::versionFunctionsDeploying Qt5 on Windows without Hardware AccelerationDifference between glGetUniformLocation and glGetAttribLocationHow to enable multisampling Anti-Aliasing with QOpenGLWidget?Any way to control FP precision in desktop OpenGL?
How often is duct tape used during crewed space missions?
What was the deeper meaning of Hermione wanting the cloak?
Delete empty subfolders, keep parent folder
Incorrect syntax near '+' in stored procedure sql server
Dead or alive (First time)
What are the end bytes of *.docx file format
Is there an in-universe reason Harry says this or is this simply a Rowling mistake?
As a discovery writer, how to complete unfinished novel (which is highly diverted from original plot ) after a time-gap
Other than good shoes and a stick, what are some ways to preserve your knees on long hikes?
Persuading players to be less attached to a pre-session 0 character concept
Why is the stock market so unpredictable?
Who was Chief Poking Fire?
Escape the labyrinth!
Very lazy puppy
Quick Kurodoko Puzzle: Threes and Triples
What is the origin of the "being immortal sucks" trope?
Is there a connection between IT and Ghostbusters?
Most efficient way to convert from 3.5-4.2V (singe cell LiPo) to stable 3.3V for currents up to 500 mA?
What did the controller say during my approach to land (audio clip)?
Strength of Female Chimpanzees vs. Male Chimpanzees?
Tips for remembering the order of parameters for ln?
Does Mage Hand give away the caster's position?
FME Use Output of reader in another reader
Why do we need to use transistors when building an OR gate?
Specifying OpenGL Desktop instead of ES for Qt5
Why it is necessary to set precision for the fragment shader?OpenGL ES 2.0 texturingglTexGen in OpenGL ES 2.0Where is specified how OpenGL ES 2.0 represents float texture values in the fragment shader?OpenGL program port to Android OpenGL ES2.0OpenGl ES on iOS lightshading removes colorQOpenGLFunctions_4_3_Compatibility with QOpenGLContext::versionFunctionsDeploying Qt5 on Windows without Hardware AccelerationDifference between glGetUniformLocation and glGetAttribLocationHow to enable multisampling Anti-Aliasing with QOpenGLWidget?Any way to control FP precision in desktop OpenGL?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am finally trying to wrap my head around shaders, using a tutorial I found. I decided to start with Qt5 (Windows) since I'm familiar with it and can focus on learning GLSL itself to start with. The only difference between what I'm doing and the tutorial is that I'm working with a QOpenGLWidget rather than a QOpenGLWindow (I just have a form with one widget on it, nothing special).
To get started with a fragment shader, in Qt I added a new desktop (not ES) fragment shader to my project, and Qt generates the following shader:
uniform sampler2D qt_Texture0;
varying vec4 qt_TexCoord0;
void main(void)
gl_FragColor = texture2D(qt_Texture0, qt_TexCoord0.st);
However, when compiling this shader, it generates this error:
QOpenGLShader::compile(Fragment): ERROR: 0:2: '' : No precision specified for (float)
I did a little bit of searching around and found this answer which states:
No default precision exists for fp types in fragment shaders in OpenGL ES 2.0.
From this, my conclusion is that my application is using OpenGL ES and not Desktop (otherwise it wouldn't expect a precision to be defined).
The GL version string I'm seeing is OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861). Fwiw, in Qt4 on this same machine, the version string is 3.0.0 - Build 9.17.10.4229.
Assuming my conclusion is correct, my question is: How can I configure the application to use regular OpenGL instead of OpenGL ES?
The suggestion in the comments to set the surface format's renderable type to OpenGL seemed promising, but it isn't working. For example, if I change it in the widget's constructor:
View::View (QWidget *parent) :
QOpenGLWidget(parent),
...
QSurfaceFormat f = format();
qDebug() << "type was" << f.renderableType();
f.setRenderableType(QSurfaceFormat::OpenGL);
qDebug() << "type set to" << f.renderableType();
setFormat(f);
qDebug() << "type is now" << format().renderableType();
void View::initializeGL ()
qDebug() << __FUNCTION__ << "type is now" << this->format().renderableType();
...
The issue persists and the output is (0 = default, 1 = OpenGL, 2 = OpenGLES):
type was 0
type set to 1
type is now 1
initializeGL type is now 2
So it appears to be being forced back to OpenGLES at some point between the constructor and initializeGL.
I observed similar behavior when setting the default surface format before constructing any GUI objects (and before constructing the QApplication) as well.
c++ opengl opengl-es qt5 fragment-shader
|
show 4 more comments
I am finally trying to wrap my head around shaders, using a tutorial I found. I decided to start with Qt5 (Windows) since I'm familiar with it and can focus on learning GLSL itself to start with. The only difference between what I'm doing and the tutorial is that I'm working with a QOpenGLWidget rather than a QOpenGLWindow (I just have a form with one widget on it, nothing special).
To get started with a fragment shader, in Qt I added a new desktop (not ES) fragment shader to my project, and Qt generates the following shader:
uniform sampler2D qt_Texture0;
varying vec4 qt_TexCoord0;
void main(void)
gl_FragColor = texture2D(qt_Texture0, qt_TexCoord0.st);
However, when compiling this shader, it generates this error:
QOpenGLShader::compile(Fragment): ERROR: 0:2: '' : No precision specified for (float)
I did a little bit of searching around and found this answer which states:
No default precision exists for fp types in fragment shaders in OpenGL ES 2.0.
From this, my conclusion is that my application is using OpenGL ES and not Desktop (otherwise it wouldn't expect a precision to be defined).
The GL version string I'm seeing is OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861). Fwiw, in Qt4 on this same machine, the version string is 3.0.0 - Build 9.17.10.4229.
Assuming my conclusion is correct, my question is: How can I configure the application to use regular OpenGL instead of OpenGL ES?
The suggestion in the comments to set the surface format's renderable type to OpenGL seemed promising, but it isn't working. For example, if I change it in the widget's constructor:
View::View (QWidget *parent) :
QOpenGLWidget(parent),
...
QSurfaceFormat f = format();
qDebug() << "type was" << f.renderableType();
f.setRenderableType(QSurfaceFormat::OpenGL);
qDebug() << "type set to" << f.renderableType();
setFormat(f);
qDebug() << "type is now" << format().renderableType();
void View::initializeGL ()
qDebug() << __FUNCTION__ << "type is now" << this->format().renderableType();
...
The issue persists and the output is (0 = default, 1 = OpenGL, 2 = OpenGLES):
type was 0
type set to 1
type is now 1
initializeGL type is now 2
So it appears to be being forced back to OpenGLES at some point between the constructor and initializeGL.
I observed similar behavior when setting the default surface format before constructing any GUI objects (and before constructing the QApplication) as well.
c++ opengl opengl-es qt5 fragment-shader
1
You probably have to setQSurface::RenderableTypetoOpenGLfor theQOpenGLWidget
– dave
Mar 28 at 14:21
@dave Hm; so I tried setting it toOpenGLin the default surface format (it was originallyDefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the timeinitializeGLis called the widget's format isOpenGLESagain. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.
– Jason C
Mar 28 at 14:28
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
1
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51
|
show 4 more comments
I am finally trying to wrap my head around shaders, using a tutorial I found. I decided to start with Qt5 (Windows) since I'm familiar with it and can focus on learning GLSL itself to start with. The only difference between what I'm doing and the tutorial is that I'm working with a QOpenGLWidget rather than a QOpenGLWindow (I just have a form with one widget on it, nothing special).
To get started with a fragment shader, in Qt I added a new desktop (not ES) fragment shader to my project, and Qt generates the following shader:
uniform sampler2D qt_Texture0;
varying vec4 qt_TexCoord0;
void main(void)
gl_FragColor = texture2D(qt_Texture0, qt_TexCoord0.st);
However, when compiling this shader, it generates this error:
QOpenGLShader::compile(Fragment): ERROR: 0:2: '' : No precision specified for (float)
I did a little bit of searching around and found this answer which states:
No default precision exists for fp types in fragment shaders in OpenGL ES 2.0.
From this, my conclusion is that my application is using OpenGL ES and not Desktop (otherwise it wouldn't expect a precision to be defined).
The GL version string I'm seeing is OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861). Fwiw, in Qt4 on this same machine, the version string is 3.0.0 - Build 9.17.10.4229.
Assuming my conclusion is correct, my question is: How can I configure the application to use regular OpenGL instead of OpenGL ES?
The suggestion in the comments to set the surface format's renderable type to OpenGL seemed promising, but it isn't working. For example, if I change it in the widget's constructor:
View::View (QWidget *parent) :
QOpenGLWidget(parent),
...
QSurfaceFormat f = format();
qDebug() << "type was" << f.renderableType();
f.setRenderableType(QSurfaceFormat::OpenGL);
qDebug() << "type set to" << f.renderableType();
setFormat(f);
qDebug() << "type is now" << format().renderableType();
void View::initializeGL ()
qDebug() << __FUNCTION__ << "type is now" << this->format().renderableType();
...
The issue persists and the output is (0 = default, 1 = OpenGL, 2 = OpenGLES):
type was 0
type set to 1
type is now 1
initializeGL type is now 2
So it appears to be being forced back to OpenGLES at some point between the constructor and initializeGL.
I observed similar behavior when setting the default surface format before constructing any GUI objects (and before constructing the QApplication) as well.
c++ opengl opengl-es qt5 fragment-shader
I am finally trying to wrap my head around shaders, using a tutorial I found. I decided to start with Qt5 (Windows) since I'm familiar with it and can focus on learning GLSL itself to start with. The only difference between what I'm doing and the tutorial is that I'm working with a QOpenGLWidget rather than a QOpenGLWindow (I just have a form with one widget on it, nothing special).
To get started with a fragment shader, in Qt I added a new desktop (not ES) fragment shader to my project, and Qt generates the following shader:
uniform sampler2D qt_Texture0;
varying vec4 qt_TexCoord0;
void main(void)
gl_FragColor = texture2D(qt_Texture0, qt_TexCoord0.st);
However, when compiling this shader, it generates this error:
QOpenGLShader::compile(Fragment): ERROR: 0:2: '' : No precision specified for (float)
I did a little bit of searching around and found this answer which states:
No default precision exists for fp types in fragment shaders in OpenGL ES 2.0.
From this, my conclusion is that my application is using OpenGL ES and not Desktop (otherwise it wouldn't expect a precision to be defined).
The GL version string I'm seeing is OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861). Fwiw, in Qt4 on this same machine, the version string is 3.0.0 - Build 9.17.10.4229.
Assuming my conclusion is correct, my question is: How can I configure the application to use regular OpenGL instead of OpenGL ES?
The suggestion in the comments to set the surface format's renderable type to OpenGL seemed promising, but it isn't working. For example, if I change it in the widget's constructor:
View::View (QWidget *parent) :
QOpenGLWidget(parent),
...
QSurfaceFormat f = format();
qDebug() << "type was" << f.renderableType();
f.setRenderableType(QSurfaceFormat::OpenGL);
qDebug() << "type set to" << f.renderableType();
setFormat(f);
qDebug() << "type is now" << format().renderableType();
void View::initializeGL ()
qDebug() << __FUNCTION__ << "type is now" << this->format().renderableType();
...
The issue persists and the output is (0 = default, 1 = OpenGL, 2 = OpenGLES):
type was 0
type set to 1
type is now 1
initializeGL type is now 2
So it appears to be being forced back to OpenGLES at some point between the constructor and initializeGL.
I observed similar behavior when setting the default surface format before constructing any GUI objects (and before constructing the QApplication) as well.
c++ opengl opengl-es qt5 fragment-shader
c++ opengl opengl-es qt5 fragment-shader
edited Mar 28 at 15:23
Jason C
asked Mar 28 at 14:15
Jason CJason C
29.8k10 gold badges79 silver badges129 bronze badges
29.8k10 gold badges79 silver badges129 bronze badges
1
You probably have to setQSurface::RenderableTypetoOpenGLfor theQOpenGLWidget
– dave
Mar 28 at 14:21
@dave Hm; so I tried setting it toOpenGLin the default surface format (it was originallyDefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the timeinitializeGLis called the widget's format isOpenGLESagain. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.
– Jason C
Mar 28 at 14:28
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
1
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51
|
show 4 more comments
1
You probably have to setQSurface::RenderableTypetoOpenGLfor theQOpenGLWidget
– dave
Mar 28 at 14:21
@dave Hm; so I tried setting it toOpenGLin the default surface format (it was originallyDefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the timeinitializeGLis called the widget's format isOpenGLESagain. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.
– Jason C
Mar 28 at 14:28
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
1
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51
1
1
You probably have to set
QSurface::RenderableType to OpenGL for the QOpenGLWidget– dave
Mar 28 at 14:21
You probably have to set
QSurface::RenderableType to OpenGL for the QOpenGLWidget– dave
Mar 28 at 14:21
@dave Hm; so I tried setting it to
OpenGL in the default surface format (it was originally DefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the time initializeGL is called the widget's format is OpenGLES again. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.– Jason C
Mar 28 at 14:28
@dave Hm; so I tried setting it to
OpenGL in the default surface format (it was originally DefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the time initializeGL is called the widget's format is OpenGLES again. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.– Jason C
Mar 28 at 14:28
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
1
1
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51
|
show 4 more comments
1 Answer
1
active
oldest
votes
Qt5 on Windows will use ANGLE as a fallback (emulating OpenGL ES 2.0 with Direct3D) if either the video card is blacklisted (in ANGLE configuration at the time Qt was compiled) or the video driver does not support modern OpenGL (i.e. if you have only the stock driver provided by Microsoft).
You can force the application to use OpenGL instead of angle by adding:
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
in your main.cpp file or by setting the environment variable QT_OPENGL to "desktop" (without quotes). You can find more details here: http://doc.qt.io/qt-5/windows-requirements.html
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399801%2fspecifying-opengl-desktop-instead-of-es-for-qt5%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Qt5 on Windows will use ANGLE as a fallback (emulating OpenGL ES 2.0 with Direct3D) if either the video card is blacklisted (in ANGLE configuration at the time Qt was compiled) or the video driver does not support modern OpenGL (i.e. if you have only the stock driver provided by Microsoft).
You can force the application to use OpenGL instead of angle by adding:
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
in your main.cpp file or by setting the environment variable QT_OPENGL to "desktop" (without quotes). You can find more details here: http://doc.qt.io/qt-5/windows-requirements.html
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
add a comment
|
Qt5 on Windows will use ANGLE as a fallback (emulating OpenGL ES 2.0 with Direct3D) if either the video card is blacklisted (in ANGLE configuration at the time Qt was compiled) or the video driver does not support modern OpenGL (i.e. if you have only the stock driver provided by Microsoft).
You can force the application to use OpenGL instead of angle by adding:
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
in your main.cpp file or by setting the environment variable QT_OPENGL to "desktop" (without quotes). You can find more details here: http://doc.qt.io/qt-5/windows-requirements.html
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
add a comment
|
Qt5 on Windows will use ANGLE as a fallback (emulating OpenGL ES 2.0 with Direct3D) if either the video card is blacklisted (in ANGLE configuration at the time Qt was compiled) or the video driver does not support modern OpenGL (i.e. if you have only the stock driver provided by Microsoft).
You can force the application to use OpenGL instead of angle by adding:
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
in your main.cpp file or by setting the environment variable QT_OPENGL to "desktop" (without quotes). You can find more details here: http://doc.qt.io/qt-5/windows-requirements.html
Qt5 on Windows will use ANGLE as a fallback (emulating OpenGL ES 2.0 with Direct3D) if either the video card is blacklisted (in ANGLE configuration at the time Qt was compiled) or the video driver does not support modern OpenGL (i.e. if you have only the stock driver provided by Microsoft).
You can force the application to use OpenGL instead of angle by adding:
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
in your main.cpp file or by setting the environment variable QT_OPENGL to "desktop" (without quotes). You can find more details here: http://doc.qt.io/qt-5/windows-requirements.html
answered Mar 29 at 17:22
Sergio MonteleoneSergio Monteleone
2,1123 silver badges15 bronze badges
2,1123 silver badges15 bronze badges
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
add a comment
|
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
Oh wow; that totally worked. The version string is "3.1.0 - Build 9.17.10.4229" now; and my shaders compile and run just fine. Awesome, thanks!
– Jason C
Mar 29 at 20:07
1
1
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
I'm glad it worked. Good luck with your project!
– Sergio Monteleone
Mar 29 at 22:06
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55399801%2fspecifying-opengl-desktop-instead-of-es-for-qt5%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You probably have to set
QSurface::RenderableTypetoOpenGLfor theQOpenGLWidget– dave
Mar 28 at 14:21
@dave Hm; so I tried setting it to
OpenGLin the default surface format (it was originallyDefaultRenderableType) before creating the UI objects, but the result is the same, and indeed by the timeinitializeGLis called the widget's format isOpenGLESagain. That seems like it's on the right track, though. I'm going to investigate that more and try to figure out why it didn't work.– Jason C
Mar 28 at 14:28
I'm starting to wonder if this has something to do with my old laptop; context initialization completely fails if I attempt to require GL version 4 or later in the surface format.
– Jason C
Mar 28 at 14:40
1
Did you try this from the Qt doc: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. It may also be that your hardware does not support that specific version of OpenGL. In that case, the Surface format you request may not be set accordingly. (See QOpenGLWidget::format )
– dave
Mar 28 at 14:43
@dave Yeah, I did it before constructing the QApplication. I guess it's just not supported on this machine. Everything in your comments seems to make sense and the conclusion that it's not supported seems reasonable, if you feel like throwing it up as an answer, I think there's enough evidence that it's correct at this point. I'll see if I can find another way to verify this machine's capabilities. I don't have a newer computer to test with.
– Jason C
Mar 28 at 14:51