QT和MS Windows中的原生OpenGL支持 [英] QT and native OpenGL support in MS Windows

查看:409
本文介绍了QT和MS Windows中的原生OpenGL支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试导入多维数据集



不幸的是,当试图打开 .pro 文件我得到以下错误:




项目错误:此示例要求Qt配置与-opengl桌面


在网上做一点研究我意识到默认情况下QT OpenGL支持是建立在 ANGLE-library ,我意识到是一个OpenGL到DirectX9.0的翻译。



因此,我有两个选项(链接< a>):


  1. 安装ANGLE。

  2. 重新编译QTv5.3与选项 -opengl桌面

问题是我通过 Windows的QT在线安装程序



Q:

考虑到上面的内容,我应该如何使用原生的OpenGL支持重新编译QTv5.3(即 -opengl desktop 选项)当我通过Windows在线安装程序安装QTv5.3?

解决方案

虽然你可以自己编译, ,有一个更简单的选项。
Qt在线安装程序提供几个发行版本:不同版本的Qt,用于不同的目标,支持或不支持OpenGL。



最简单的方法安装Qt 5.3.2 MSVC 2013 OpenGL:




  • 运行< QT_FOLDER> \MaintenanceTool.exe 如果您从未安装过Qt)

  • 选择包管理器,按下一步

  • Qt - > 5.3 c> msvc2013 32位OpenGL (以及您需要的任何其他版本)

  • 下一步。 ..



它将安装在< QT_FOLDER> \msvc2013_opengl



然后,您可能需要使用pointVisual Studio AddIn来更正Qt文件夹(可以携带多个版本)。





最简单的方法来创建Qt和MSVC的朋友



您可以轻松地生成Visual Studio qmake ,从Qt'项目 .pro 文件中创建.vcxproj



要执行此操作:




  • 打开 VS2013 x86 Native Tools命令提示符(或设置路径C:\Program Files(x86)\ Microsoft Visual Studio 12.0 \VC\vcvarsall .batx86

  • 将所需的Qt版本添加到路径:

      set PATH =%PATH%;< QT_FOLDER> \msvc2013_opengl\bin 


  • 转到Qt项目文件夹并生成MSVC项目:

      cd< pro_folder> 
    qmake -tp vc


  • 您会在同一个文件夹中找到 .vcxproj 文件中包含所有Qt的铃声和口哨(moc'ing,uic'ing,rcc'ing等)设置为构建事件

  • 操作,只要您更改 .pro 文件。每次重新加载 .vcxproj (不需要关闭Visual Studio;它会要求您在检测到更改时重新加载)。将 .vcxproj 视为临时文件,不要手动更改。调整 .pro 中的所有内容。



提示:写 .bat 文件自动执行所有这些操作。



HTH


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):

  1. Install ANGLE.
  2. 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

这篇关于QT和MS Windows中的原生OpenGL支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆