I'm trying to import the cube example in MS visual studio 2013 via the QT add-in.
Unfortunately, when trying to open the .pro
file I get the following error:
Project ERROR: This example requires Qt to be configured with -opengl desktop
Doing a little research in the web I realized that by default QT OpenGL support is build on ANGLE-library which as I realized is an OpenGL to DirectX9.0 kind of translator.
Thus, I have two options (link):
- Install ANGLE.
- Recompile QTv5.3 with option
-opengl desktop
.
The problem is that I installed QTv5.3 via QT online installer for windows.
Q:
Considering the above, how am I supposed to recompile QTv5.3 with native OpenGL support (i.e., with -opengl desktop
option) when I've installed QTv5.3 via the windows online installer?
Although you can compile it yourself with any flags you wish, there is a simpler option.
Qt online installer provides several distributions: different versions of Qt, for different targets, with or without OpenGL support.
Easiest way to install Qt 5.3.2 MSVC 2013 OpenGL:
- run
<QT_FOLDER>\MaintenanceTool.exe
(or online installer if you have never installed Qt yet)
- choose
Package manager
, press Next
- Under
Qt
->5.3
check msvc2013 32-bit OpenGL
(along with any other version you need)
- Press
Next
...
It will be installed in <QT_FOLDER>\msvc2013_opengl
Then you probably will need to pointVisual Studio AddIn to correct Qt folder (it can carry multiple versions).
Easiest way to make Qt and MSVC friends
You can easily generate Visual Studio .vcxproj
file from Qt' project .pro
file by running qmake
. No any addons required.
To do this:
- open
VS2013 x86 Native Tools Command Prompt
(or set up path with "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86
)
add desired Qt version to path:
set PATH=%PATH%;<QT_FOLDER>\msvc2013_opengl\bin
go to Qt project folder and generate MSVC project:
cd <pro_folder>
qmake -tp vc
- You will find in the same folder a
.vcxproj
file with all Qt's bells and whistles (moc'ing, uic'ing, rcc'ing etc.) set up like build events
- Repeat this operation whenever you change
.pro
file. Reload .vcxproj
each time (no need to close Visual Studio; it will ask you to reload when it detects changes). Consider .vcxproj
as temporary, generated file and don't change it manually. Tweak all the stuff in .pro
.
Hint: write .bat
file to do all this stuff automatically.
HTH
You'll need to download and build either the 32-bit version or the 64-bit version.
I built from scratch, but for ANGLE, not OpenGL.
This page should be read before you decide on going either direction.