Error: QOpenGLShader: could not create shader - wh

2019-06-20 11:17发布

I've downloaded and installed "Qt 5.2 mingw (opengl and x86)" version. When i run Qt projects with this version of Qt, there is no problem. But when i run a Qt Quick application, the program crash and following messages log in debug:

getProcAddress: Unable to resolve 'glGenRenderbuffers'
getProcAddress: Unable to resolve 'glGenRenderbuffersOES'
getProcAddress: Unable to resolve 'glGenRenderbuffersARB'
getProcAddress: Unable to resolve 'glGenRenderbuffersEXT'
getProcAddress: Unable to resolve 'glBindRenderbuffer'
getProcAddress: Unable to resolve 'glBindRenderbufferOES'
getProcAddress: Unable to resolve 'glBindRenderbufferARB'
getProcAddress: Unable to resolve 'glBindRenderbufferEXT'
getProcAddress: Unable to resolve 'glRenderbufferStorage'
getProcAddress: Unable to resolve 'glRenderbufferStorageOES'
getProcAddress: Unable to resolve 'glRenderbufferStorageARB'
getProcAddress: Unable to resolve 'glRenderbufferStorageEXT'
getProcAddress: Unable to resolve 'glGenRenderbuffers'
getProcAddress: Unable to resolve 'glGenRenderbuffersOES'
getProcAddress: Unable to resolve 'glGenRenderbuffersARB'
getProcAddress: Unable to resolve 'glGenRenderbuffersEXT'
getProcAddress: Unable to resolve 'glBindRenderbuffer'
getProcAddress: Unable to resolve 'glBindRenderbufferOES'
getProcAddress: Unable to resolve 'glBindRenderbufferARB'
getProcAddress: Unable to resolve 'glBindRenderbufferEXT'
getProcAddress: Unable to resolve 'glRenderbufferStorage'
getProcAddress: Unable to resolve 'glRenderbufferStorageOES'
getProcAddress: Unable to resolve 'glRenderbufferStorageARB'
getProcAddress: Unable to resolve 'glRenderbufferStorageEXT'
getProcAddress: Unable to resolve 'glFramebufferRenderbuffer'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferOES'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferARB'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferEXT'
getProcAddress: Unable to resolve 'glFramebufferRenderbuffer'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferOES'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferARB'
getProcAddress: Unable to resolve 'glFramebufferRenderbufferEXT'
getProcAddress: Unable to resolve 'glGenBuffers'
getProcAddress: Unable to resolve 'glGenBuffersOES'
getProcAddress: Unable to resolve 'glGenBuffersARB'
getProcAddress: Unable to resolve 'glGenBuffersEXT'
getProcAddress: Unable to resolve 'glBindBuffer'
getProcAddress: Unable to resolve 'glBindBufferOES'
getProcAddress: Unable to resolve 'glBindBufferARB'
getProcAddress: Unable to resolve 'glBindBufferEXT'
getProcAddress: Unable to resolve 'glBufferData'
getProcAddress: Unable to resolve 'glBufferDataOES'
getProcAddress: Unable to resolve 'glBufferDataARB'
getProcAddress: Unable to resolve 'glBufferDataEXT'
getProcAddress: Unable to resolve 'glBindBuffer'
getProcAddress: Unable to resolve 'glBindBufferOES'
getProcAddress: Unable to resolve 'glBindBufferARB'
getProcAddress: Unable to resolve 'glBindBufferEXT'
getProcAddress: Unable to resolve 'glBindBuffer'
getProcAddress: Unable to resolve 'glBindBufferOES'
getProcAddress: Unable to resolve 'glBindBufferARB'
getProcAddress: Unable to resolve 'glBindBufferEXT'
getProcAddress: Unable to resolve 'glCreateProgram'
getProcAddress: Unable to resolve 'glCreateProgramARB'
getProcAddress: Unable to resolve 'glCreateProgramObject'
getProcAddress: Unable to resolve 'glCreateProgramObjectARB'
QOpenGLShaderProgram: could not create shader program 
getProcAddress: Unable to resolve 'glCreateShader'
getProcAddress: Unable to resolve 'glCreateShaderARB'
getProcAddress: Unable to resolve 'glCreateShaderObject'
getProcAddress: Unable to resolve 'glCreateShaderObjectARB'
QOpenGLShader: could not create shader 
Renderer failed shader compilation: 
"" 

How can i solve this issue? Is this issue related to my graphic card?

1条回答
Anthone
2楼-- · 2019-06-20 11:49

This happens when your graphic card drivers do not support OpenGL 2.0 which is mandatory for Qt.Quick applications.

The first solution would be to upgrade your graphic card driver. You can also use OpenGL extensions Viewer to verify which OpenGL versions you support.

On the other hand, if you want to be able to deploy your apps to other Windows installations and do not want to have to ask users to update their drivers then you should not use the Qt5 build based on OpenGL but the ones based on ANGLE. Regretfully, since Qt 5.1, the Qt team stopped releasing versions of Qt with ANGLE and mingw. So you either need to recompile Qt yourself or use a version based on another compiler.

More information about Qt5 and Windows and ANGLE/OpenGL can be found here

EDIT for Qt5.3

On Qt 5.3 a new signal has been added to QQuickWindow called sceneGraphError which allows you to know that the initialization failed instead of just getting a blank screen.

Also the Qt team is working on the ability to try OpenGL first on the client machine and if it fails fallback to ANGLE. This is still experimental in Qt 5.3 and should be part of the Qt 5.4 release.

查看更多
登录 后发表回答