问题
OpenGL and Windows Remote don't play along nicely.
Solutions for this are dependent on the use case and answers are fragmented across the vast depths of the net. This is a write-up I wish existed when I started researching this, both for coders and non-coders.
Problem:
A RDP session of Windows does not expose the graphics card, at least not directly. For instance you cannot change the desktop resolution and GraphicsCard drivers usually just disable their setting menus. Starting a OpenGL context higher than v1.1 fails because of this. The, especially in support IRCs, often suggested "Don't use WindowsRemote" is unfortunately not an option for many. In many corporate environments Windows Remote is a constantly used tool and an app has to work there as well.
Non-Coder workarounds
You can start the OpenGL program, allowing it to see the graphics card, create an opengl context and then connect via WindowsRemote. This always works, as Windows remote just transfers the window content. This can be accomplished by:
- A batch script, that closes the session and starts the program, allowing you to connect to the program already running. (Source)
- Using VNC or other to remote into the machine, start the program and then switch to Windows Remote. (Simple VNC programm, also with a portable client)
Coder workarounds
(Only for OpenGL ES)Translate OpenGL to DirectX. DirectX works under Windows Remote flawselly and even has a Software rendering fallback built into DX11 if something fails.
- Use the ANGLE Project to do this at run-time. This is what QT officially suggests you do and how Chrome and Firefox implement WebGL. (Source)
Switch to software rendering as a fall back. Some CAD software like 3dsMax does this for instance:
- Under SDL2 you can use SDL_CreateSoftwareRenderer (Source)
- Under GLFW version 3.3 will release OSMesa (Mesa's off screen rendering), in the mean time you can build the Github version with -DGLFW_USE_OSMESA=TRUE, but I personally still struggle to get that running (Source)
- Directly use Mesa's LLVM pipe for a fast OpenGL implementation. (Source)
Misc:
- Use OpenGL 1.1: Windows has a built in implementation of OpenGL 1.1 and earlier. Some game engines have a built in fall back to this and thus work under Windows Remote.
- Apparently there is a middle-ware, that allows for even OpenGL 4 over Windows Remote, but it's part of a bigger package and is a commercial solution. (Source)
Any other solutions or corrections are greatly appreciated.
回答1:
Windows Remote Desktop will open a remote session. I think, at least when it comes to NVIDIA, only the drivers for professional (Quadro) workstation cards have remote session support (never tested this myself though). Normal GeForce drivers do not work in a remote session (in my experience). That not only affects OpenGL. As far as I remember, e.g., CUDA will also not work in a remote session.
Personally, if you have to work remotely on stuff that's using the GPU, I would recommend TeamViewer or VNC. They probably need more bandwidth, but since they will simply remote control the local interactive session rather than work in a remote session, everything will work just like it would if you were sitting in front of the machine. One thing to be aware of, is that using TeamViewer/VNC will, of course, interfere with anyone who is actually sitting in front of the machine…
回答2:
Remote Desktop and OpenGL does not play very well. When you connect to a Windows box the OpenGL Driver is unloaded and you end up with software emulation of OpenGL.
When you disconnect from the Windows box the OpenGL driver is not reloaded. This causes issues when you are running tests on the machine as you have to physically login to the machine to reset the drivers.
The solution I ended up using was to:
- Disable Remote Desktop.
- Delete all other software for remote desktop access. Because if it's used for logging in remotely the current set of drivers loaded may be messed up.
- Install NoMachine
NoMachine is my personal favourite (when it does not play up) for a number of reasons:
- Hardware acceleration of compression (video of desktop).
- Works on Windows and Linux.
- Works well on low-bandwidth connections especially if the client and server have the necessary hardware for compression of the data stream.
- On Linux you get your desktop as you last left it when you were sitting in front of the machine.
- On Windows it does not affect OpenGL.
- currently free for personal and commercial use. Do check the licence in case it's changed.
When NoMachine plays up it hogs the CPU but this happens rarely. It is however in active development
Others to consider:
- TurboVNC
- TightVNC
- TeamWare - only free for personal use.
回答3:
OpenGL works great by RDP with professional Nvidia cards without anything like virtual machines and RemoteFX. For Quadro (Quadro 4000 tested) you need driver 377.xx. For M60 you can use the same driver. If you want to use last driver with M60, you have to change the driver mode to WDDM mode (see c:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.1.pdf). It is possible that there are some problems with licensing in this last case.
来源:https://stackoverflow.com/questions/51705471/current-state-and-solutions-for-opengl-over-windows-remote