Error: QOpenGLShader: could not create shader - when compiling QtQuick applications with Qt5.2 Mingw OpenGL

匿名 (未验证) 提交于 2019-12-03 02:30:02

问题:

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:

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.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!