問題描述
如何從我的 windows 機器運行安裝在 linux 機器上的 OpenGL 應用程序? (How can I run an OpenGL application installed on a linux machine from my windows machine?)
本著樂於助人的精神,這是我遇到並解決的問題,所以我將在這裡回答這個問題。
問題
我有:
必須在 Redhat 或 SuSE 企業上安裝的應用程序。
它有巨大的系統要求,需要 OpenGL。
它是一套工具的一部分,需要在一台機器上一起運行。
這個應用程序是用於工時方面的時間密集型任務。
我不想坐在服務器機房里處理這個應用程序。
所以,問題來了.. . 如何從遠程 Windows 機器運行此應用程序?
我將概述我的解決方案。隨意評論替代品。該解決方案也適用於更簡單的環境。我的情況有些極端。
參考解法
方法 1:
Solution
I installed two pieces of software:
XMing‑mesa The mesa part is important.
PuTTY configuration
Connection‑>Seconds Between Keepalives: 30
Connection‑>Enable TCP Keepalives: Yes
Connection‑>SSH‑>X11‑>Enable X11 forwarding: Yes
Connection‑>SSH‑>X11‑>X display location: localhost:0:0
Lauching
Run Xming which will put simply start a process and put an icon in your system tray. Launch putty, pointing to your linux box, with the above configuration. Run program
Hopefully, Success!
方法 2:
If you want the OpenGL rendering to be performed on your local machine, using a Windows X server, like Xming is a good solution. However, if you want rendering to be done on the remote end with just images sent to the local machine, you want a specialized VNC system that can handle remote OpenGL rendering, like VirtualGL.
方法 3:
You could also use VNC ( like cross platform remote desktop ) X is more efficent since it only sends draw commands rather than pixels, but if you are using opengl it is likely that most of the data is a rendered image anyway.
Another big advantage of VNC is that you can start the program locally on the server and then connect to it with VNC, drop the connection, reconnect from another machine etc without disturbing the main running program.
方法 4:
For OpenGL, running an X server is definitely a better solution. Just make sure the application is developed to be networked. It should NOT use immediate mode for rendering and textures should be RARELY transferred.
Why is X server a better solution in this case (as opposed to VNC)? Because you get acceleration on workstation, while VNC'ed solution is usually not even accelerated on the mainframe. So as long as data is buffered on the X server (using vertex arrays, vertex buffer objects, texture objects, etc) you should get much higher speed than using VNC, especially with complex scenes since VNC has to analyze, transfer and decode them as pixels.
方法 5:
If you need server glx version 1.2 the free version of Xming (Mesa 2007) works fine. But if your application needs version 1.4, example qt5, the X Server from Cygwin works free to run it use this commands:
[On server]
sudo vi /etc/ssh/ssh_config
Add:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalHost no
AllowTcpForwarding yes
TCPKeepAlive yes
ClientAliveInterval 30
ClientAliveCountMax 10000
sudo vi ~/.bashrc
Add:
export DISPLAY=ip_from_remote:0
Now restart ssh server
[On Client slide]
Install Cygwin64 (with support to X package) after that run this command:
d:\cygwin64\bin\run.exe ‑‑quote /usr/bin/bash.exe ‑l ‑c "cd; /usr/bin/xinit /etc/X11/xinit/startxwinrc ‑‑ /usr/bin/XWin :0 ‑ac ‑multiwindow ‑listen tcp"
Now execute ssh client:
d:\cygwin64\bin\mintty.exe ‑i /Cygwin‑Terminal.ico ‑e /usr/bin/ssh ‑Y user_name@ip_from_server
(by scubabbl、scubabbl、tkerwin、Martin Beckett、Ivan Vučica、Rafael Duarte)