关于覆盆子pi的Qt OpenGl上下文

时间:2016-01-29 09:05:59

标签: qt opengl raspbian raspberry-pi2 qtopengl

我正在编写一个带有Qt5 opengl上下文的程序。它在我的桌面上运行良好(fedora 23)。但是我必须在pi 2上运行它。所以我在每个源代码的地方下载Qt5并在pi上本地编译它。当我试图在pi上编译并运行我的程序时,它会抛出以下错误:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled

在Qt论坛中,我看到Raspberry pi XCB无论如何都无法与egl集成。此外,当我配置Qt源代码时,X选项上的EGL是否定的。但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集成?

如果在覆盆子pi上既没有EGL也没有GLX集成,我该怎么做才能在pi上运行我的应用程序?

1 个答案:

答案 0 :(得分:1)

你需要一个Raspberry Pi 2 。你必须为它重新编译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>

如果在sysroot中安装了正确的东西,它将检测并正确配置。