Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
基于raspberry pi的Qt OpenGl上下文_Qt_Opengl_Raspbian_Raspberry Pi2_Qtopengl - Fatal编程技术网

基于raspberry pi的Qt OpenGl上下文

基于raspberry pi的Qt OpenGl上下文,qt,opengl,raspbian,raspberry-pi2,qtopengl,Qt,Opengl,Raspbian,Raspberry Pi2,Qtopengl,我正在编写一个使用Qt5 opengl上下文的程序。它在我的桌面(Fedora23)上运行良好。但我必须在pi 2上运行它。因此,我在每个地方下载Qt5源代码,并在pi上以本机方式编译它。当我试图在pi上编译和运行我的程序时,它抛出以下错误: QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled 在Qt论坛上,我看到Raspberry pi XCB无论如何都不能与egl集成

我正在编写一个使用Qt5 opengl上下文的程序。它在我的桌面(Fedora23)上运行良好。但我必须在pi 2上运行它。因此,我在每个地方下载Qt5源代码,并在pi上以本机方式编译它。当我试图在pi上编译和运行我的程序时,它抛出以下错误:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
在Qt论坛上,我看到Raspberry pi XCB无论如何都不能与egl集成。另外,当我配置Qt源代码时,EGL on x选项为no,但GLX已启用。是否有设置QXcbIntegration以在pi上使用GLX的方法

我试图修复XCB和egl的集成。因此,我尝试在qtbase的config.tests/qpa目录中重新编译egl-x11测试,以查看错误。产出为:

g++ -c -pipe -O2 -Wall -W -fPIC  -I. -isystem /usr/include/libdrm -I../../../mkspecs/linux-g++ -o egl-x11.o egl-x11.cpp
egl-x11.cpp: In function ‘int main(int, char**)’:
egl-x11.cpp:47:20: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive]
egl-x11.cpp:49:11: error: invalid conversion from ‘EGLNativeDisplayType {aka void*}’ to ‘Display* {aka _XDisplay*}’ [-fpermissive]
egl-x11.cpp:50:79: error: invalid conversion from ‘Window {aka long unsigned int}’ to ‘EGLNativeWindowType {aka void*}’ [-fpermissive]
egl-x11.cpp:51:26: error: invalid conversion from ‘EGLNativeWindowType {aka void*}’ to ‘Window {aka long unsigned int}’ [-fpermissive]
/usr/include/X11/Xlib.h:2251:12: error:   initializing argument 2 of ‘int XDestroyWindow(Display*, Window)’ [-fpermissive]
Makefile:530: recipe for target 'egl-x11.o' failed
make: *** [egl-x11.o] Error 1
有没有办法修复XCB和EGL集成


如果在raspberry pi上既不能集成EGL也不能集成GLX,那么我可以如何在pi上运行我的应用程序?

您需要一个raspberry pi2。您必须为它重新编译Qt库

它将使用使用EGL的Qt EGLFS平台集成运行。这意味着一个全屏Qt应用程序,没有桌面环境

我没有在raspberry上构建库,但是我已经完成了Qt库的交叉编译。它需要一个raspberry sysroot来针对它配置Qt:

./configure -opengl es2 -device linux-rasp-pi2-g++ -sysroot "$R" -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -make tools ... <lots of other options>
/configure-opengl es2-device linux-rasp-pi2-g++-sysroot“$R”-开源-确认许可证-优化qmake-减少导出-发布-制作libs-制作工具。。。
如果在sysroot中安装了正确的东西,它将正确地检测和配置