简体   繁体   English

Raspberry Pi 上的 Kivy:将提供商从 EGL 更改为 SDL2?

[英]Kivy on Raspberry Pi: changing provider from EGL to SDL2?

Running a Kivy application on my Raspberry Pi gives me an output like this:在我的 Raspberry Pi 上运行 Kivy 应用程序会得到如下输出:

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_16-04-26_23.txt
[INFO   ] [Kivy        ] v1.9.2-dev0
[INFO   ] [Python      ] v2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2]
[INFO   ] [Factory     ] 193 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: pygame
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [GL          ] OpenGL version <OpenGL ES 2.0>
[INFO   ] [GL          ] OpenGL vendor <Broadcom>
[INFO   ] [GL          ] OpenGL renderer <VideoCore IV HW>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Shader      ] fragment shader: <Compiled>
[INFO   ] [Shader      ] vertex shader: <Compiled>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available

However, no window launches.但是,没有窗口启动。 Notice the Provider: egl_rpi .注意Provider: egl_rpi

In my Windows Kivy, the Provider is SDL2.在我的 Windows Kivy 中,提供程序是 SDL2。 Additionally, I am able to launch a sample mp3 video using SDL as the provider on the Raspberry Pi with:此外,我可以使用 SDL 作为 Raspberry Pi 上的提供程序启动一个示例 mp3 视频:

sudo SDL_VIDEODRIVER=fbcon SDL_FBDEV=/dev/fb1 mplayer -vo sdl -framedrop test.mpg

My question is: how do I change the Provider to SDL2 for Kivy on the Pi?我的问题是:如何将 Pi 上的 Kivy 的提供程序更改为 SDL2?

Adding the following line of code to the top of your Python file should switch the provider to sdl2将以下代码行添加到 Python 文件的顶部应该将提供程序切换到 sdl2

import os
os.environ['KIVY_WINDOW'] = 'sdl2'

Reference: here参考: 这里

I'm having the same issue as you, no window is displayed with egl_rpi .我和你有同样的问题, egl_rpi没有显示窗口。 I switch to SDL2 but the application fails to load.我切换到SDL2但应用程序无法加载。 I believe this is due to a custom driver for my 3.5" SPI Display. Perhaps you'll have better luck with your video driver.我相信这是由于我的 3.5" SPI 显示器的自定义驱动程序。也许你的视频驱动程序会更好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM