x11 でラズパイのアプリウィンドウをMacで開く - Naohiro2g/Raspberry-Pi-Projects GitHub Wiki
ラズパイでのリモート開発で。 ラズパイのアプリウィンドウをMacで開きたい。
MacOS用の X Window System、XQuartzをインストール。 https://www.xquartz.org
XQuartzのターミナルからssh -Xで接続。あるいは、iterm.appなどでssh -Xで接続すれば、XQuartzが起動する。
ラズパイ側のアプリを起動すると、Mac側でアプリウィンドウが開く。
Scratchもいける。VNC接続よりは快適かな?
この状態で、ラズパイ側でアプリウィンドウを開きたいときは、DISPLAY=:0.0 python3 demo.py
などとする。
Pygame 1.9.6は、この要領でX Window転送できるが、Pygame2はできなくなった? https://github.com/pygame/pygame/issues/2446
$ sudo pip3 install -U pygame==2.0.1
$ python3 -m pygame.examples.aliens
pygame 2.0.1 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 149 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 98
Current serial number in output stream: 97
エラー。。
ssh -X をやりなおして、、
$ sudo pip3 install -U pygame==1.9.6
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pygame==1.9.6
Using cached https://www.piwheels.org/simple/pygame/pygame-1.9.6-cp37-cp37m-linux_armv7l.whl
Installing collected packages: pygame
Found existing installation: pygame 2.0.1
Uninstalling pygame-2.0.1:
Successfully uninstalled pygame-2.0.1
Successfully installed pygame-1.9.6
$ python3 -m pygame.examples.aliens
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
ちゃんと動く。
ヒントになるか? 「X Window Systemを使ってリモートサーバでOpenGLなプログラムを走らせる方法」 https://itakeshi.hatenablog.com/entry/2018/02/03/134644
Windowsのとき。https://qiita.com/iwax10/items/55b14036011254a7f7a9