Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt 5.2.1 MinGW - No OpenGL rendering on other machines
Hello, first time posting here, sorry if anything is wrong with my post.
I'm developing a small app performing OpenGL 3D rendering (a Rubik's Cube, actually).
As for several other people who posted similar threads, I have trouble deploying it on other computers, as in the app starts, but doesn't display any 3D object, only the background color (for some reason, it also displays a white rectangle in the middle of the screen).
I have tried copying my DLLs from C:\Qt\5.2.1\mingw48_32\bin as well as C:\Qt\Tools\mingw48_32\bin and C:\Qt\Tools\QtCreator\bin for the DLLs I couldn't find in the first path I mentioned; I'm also wondering if mixing DLLs from different paths has an adverse effect on deployment.
As a note, I tried both Dependency Walker and ListDlls to check what DLLs were loaded by the app, on both my computer and a friend's, and the only difference was nVidia - ATI DLLs (I also know the app doesn't work on other computers with an nVidia GPU).
There is one thing I noticed, though: on some computers, it does work, although those computers don't have Qt installed (they do have some programming tools though, I believe - school computers).
At some point, I also tried downloading the OpenGL build of Qt 5.2.1 MinGW, but had no more luck with it and its DLLs.
Could anyone tell me what I did wrong/missed, and how/where I can find the proper DLLs? Would compiling Qt myself help at all?
andreyc last edited by
Have you looked on this "wiki page":http://qt-project.org/wiki/Deploy_an_Application_on_Windows ?
I must say I hadn't read this guide.
After reading through it quickly, I notice I performed several steps of it already, but I'll have to test this more thoroughly. (And no, I didn't try copying the whole Qt directory over to my friend's computer, but just might try this out)
Thanks for this link, I'll come back after more testing.
I just tried the "copy all the DLLs" part, and it still doesn't work on my friend's computer. I also tried renaming my Qt folder to "turn my PC into a clean environment" and it still works then.
I also updated the GPU driver on another computer which has an nVidia GPU (same as me), but OpenGL rendering still doesn't work there.
I'm really drawing a blank here, but I'll try again after I build Qt myself with -opengl desktop.
- What version of OpenGL did you use?
- What version of OpenGL do the other machine support?
- Do the other machines have the latest graphics drivers installed?
andreyc last edited by
Have you tried ANGLE build of Qt instead of OpenGL?
Are there any error messages if you start your application from console?
What if you build some simple opengl example (hellowindow) from Qt examples and try to run it on both machines.
A little update:
I'm using OpenGL 2.0 (I can't get versions 3.0+ to work anyway), and the test machine has its latest GPU driver installed.
I tried using the ANGLE build (installed from the web installer, Qt 5.2.1 MinGW) and the OpenGL build (downloaded and installed manually, "Qt 5.2.1 for Windows 32-bit (MinGW 4.8, OpenGL, 634 MB)"), using the corresponding DLLs each time.
It turns out that even after copying all the DLLs (as in the link posted by andreyc) didn't help: the app still displays a blank screen on the target machine.
Running the [url=https://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html]OpenGL window example[/url] does work on the target machine, though, with the same DLLs as my app.
I also tried compiling Qt myself, though it failed after I ran the configure script (first time trying this).
Back to testing, then.
I got OpenGL 3.3 to work on my machine (I wasn't using VAOs before, so the CoreProfile couldn't work).
Still no luck on the deployment side, though.
[quote]I have tried copying my DLLs from C:\Qt\5.2.1\mingw48_32\bin as well as C:\Qt\Tools\mingw48_32\bin and C:\Qt\Tools\QtCreator\bin for the DLLs I couldn’t find in the first path I mentioned; I’m also wondering if mixing DLLs from different paths has an adverse effect on deployment.[/quote]I just noticed this part. Yes, mixing versions is bad news. Take from C:\Qt\5.2.1\mingw48_32\bin ONLY. The DLLs in C:\Qt\Tools\QtCreator\bin are for Qt Creator, NOT for your own apps (Qt Creator is just another application build with Qt).
Launch the app from the command line, and see if you get any error messages.
Can you try installing the Qt SDK on your deployment machine, and see if it can build working OpenGL apps?
Also, it might be helpful if you show some code. How are you integrating OpenGL into your application?
I installed Qt on the deployment machine, and got an unpredicted result: rendering still doesn't work.
After some research, it seems the GPU (HD Radeon Mobility 3650) has issues with OpenGL, and only supports up to OpenGL 3.2 (I use 3.3).
I tweaked the code in the rendering function and in the vertex and fragment shaders to use OpenGL 2.0 again, but that didn't help.
Among all the machines I tested my app on, 2 were laptops (none of them worked), 2 others were desktop PCs (everything working on those), and I also had someone test it on their desktop PC with Qt installed (no issue either).
This makes me believe the issue doesn't come from my code, but here are the relevant bits:
in highp vec4 posAttr;
in lowp vec4 colAttr;
out lowp vec4 col;
uniform highp mat4 matrix;
col = colAttr;
gl_Position = matrix * posAttr;
in lowp vec4 col;
out lowp vec4 color;
color = col;
@vao = new QOpenGLVertexArrayObject(this);
std::vector<QVector3D> vertices = object->vertices();
std::vector<QVector3D> colors = object->colors();
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(QVector3D), &vertices, GL_STATIC_DRAW);
glBufferData(GL_ARRAY_BUFFER, colors.size() * sizeof(QVector3D), &colors, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
glDrawArrays(GL_TRIANGLES, 0, vertices.size());
Note: this is the OpenGL 3.3 version.
This code is mainly based on the [url=http://doc-snapshot.qt-project.org/qt5-stable/qtgui-openglwindow-example.html]OpenGL Window Example[/url].
You will also notice that I create and delete the VAOs and VBOs each time the function is called; this is something I'll fix later.
So it works on your desktops but not laptops? It could be a hardware issue. Although, it's a bit strange that the OpenGL Window Example works while your other one doesn't.
There are some known issues with OpenGL in Qt (see http://lists.qt-project.org/pipermail/development/2013-November/014333.html ) If you could post your machine details to https://bugreports.qt-project.org/ someone who's well-versed in OpenGL might be able to find a fix.
(I'm afraid I don't have OpenGL experience, so I can't tell if your code is correct or not).
As a last resort, have you tried using MSVC?
It has been a few months, but I have something new regarding this issue:
I ran an OpenGL app (Qt 5.3 now, if that is relevant) on 4 different computers:
- My own PC (desktop, NVIDIA GPU, the only one of the test computers with Qt installed)
- Another desktop PC with an NVIDIA GPU
- A desktop PC with an integrated Intel GPU
- A laptop with an AMD GPU
ALL PCs are running on Windows 7.
The test consists in drawing a Rubik's Cube, with colors only and with textures.
Now for the results:
- NVIDIA (both PCs):
** [url=https://dl.dropbox.com/s/udcg7jxvaxdbj8e/rubiks_pc_nvidia.png]Without textures[/url]
** [url=https://dl.dropbox.com/s/ojipiz57vu6bbuk/rubiks_pc_nvidia_t.png]With textures[/url]
** [url=https://dl.dropbox.com/s/v11hgyjas9s07i8/rubiks_pc_amd.png]Without textures[/url]
** [url=https://dl.dropbox.com/s/r6x3j6dwgt43do2/rubiks_pc_amd_t.png]With textures[/url]
- Intel, [url=https://dl.dropbox.com/s/2cu68ra7zszencj/rubiks_pc_intel.png]both with and without textures[/url]
From this test, there seems to be a difference depending on the manufacturer of the GPU, though I can't say for sure this is the only reason.
Also, as a note about my previous posts, the laptop used here was also used in the previous tests, where it wouldn't render anything (its GPU drivers haven't been updated since then).
Has anybody encountered similar results with OpenGL?