Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGLWidget - Blank Screen on different computer
Anonym last edited by Anonym
When I wanted to test my project (using QT 5.7 via VS-Addin) as release build on a different computer/OS I noticed, that the QGLWidget is just black (for normal the background should be grey with some text). (The exe as debug/release is just showing the QGLWidget correctly at the development-computer)
What I've tried:
I'm shipping the exe with all neccessary DLL's (added by windeployqt.exe). I've even checked the dependencies with Dependency Walker and everything seems fine. To avoid differencies in the OpenGL version, I've shipped opengl32.dll and glu32.dll from system32-folder. That sadly didn't change anything. Then I printed a MessageBox with the current OpenGL-Version (QGLFormat::majorVersion( )) to see if there is something wrong on the other computer. But on both computers he's returning value 2 as major version.
After that, I followed a tip from someone in the internet saying, to run the console viá "CONFIG += console". The console outputs the following on the testing-computer:
"QGLWidget::RenderText is not supported under OpenGL/ES".
I'm despairing, because I've spent several days in searching the internet. But nothing made it working. In my opinion, there can be only missing some DLL's, as the exe is showing the QGLWidget just fine on the developer computer.
(Im using Qt 5.7 and I'm developing/testing the project on Win 7 64-bit)
Thanks ahead everyone!
mtrch last edited by
Then I printed a MessageBox with the current OpenGL-Version (QGLFormat::majorVersion( )) to see if there is something wrong on the other computer. But on both computers he's returning value 2 as major version.
Check values of glGetString(GL_VERSION), glGetString(GL_RENDERER), glGetString(GL_VENDOR) and QOpenGLContext::isOpenGLES(). Maybe your application started using ANGLE OpenGL ES, because graphics drivers not installed/not supports OpenGL >= 2.0.
To avoid differencies in the OpenGL version, I've shipped opengl32.dll and glu32.dll from system32-folder
Shipping files from system32 is wrong and useless.
Anonym last edited by
Thanks mtrch for your help!
Your tip lead me in the right direction. For everyone facing the same problem:
I solved the issue by telling QApplication what kind of OpenGL to use:
QApplication a( argc, argv ); a.setAttribute( Qt::AA_UseDesktopOpenGL ); //MainWindow and stuff like that after this...
Hi and welcome to devnet,
IIRC, you should set that property before creating your QApplication object.
Anonym last edited by
Probably I don't know how to do that? Is there a static function or something like that?
You're already using the correct function but the wrong way. setAttribute is a static function.
sir_clive last edited by
I know this is a very old topic, but still THANK YOU! You just saved my life, I was already going crazy with this issue!
To all other poor souls that might have the same issue: my problem was that with Qt 5.4, the QGLWidget and QOpenGLWIdget both worked like a champ, while after upgrade to Qt 5.10, on some computers (very rare actually), I got the black screen no matter what I did. I only managed to reproduce that problem on my system under Virtual Box, other than that, I only received one single complaint about this issue (tested on at least 15 different computers under Windows, Linux and OSX, including also VMWare and Parallels installations).
Calling QApplication::setAttribute(Qt::AA_UseDesktopOpenGL) before creating the QApplication derived object solved it for me.