2
I have installed Ubuntu on Windows 10 using Windows Subsystem for Linux (WSL). I'm attempting to get OpenGL graphics to work. My ultimate objective is to be able to run the Gazebo simulator for Robot OS (ROS), which requires OpenGL. As a first step, I'm trying to ensure that OpenGL graphics are working like they're supposed to.
According to this tutorial and many others, to run ROS and Gazebo I should install VcXsrv and run the X server with the "Native OpenGL" option disabled, so I'm doing that.
My immediate problem is that OpenGL doesn't appear to be working quite right. I have installed the Mesa utils and when I run glxgears
I do see the graphics window, but the animation is extremely slow. I'd estimate that the gears are turning at about 1 revolution per minute. I can reorient the gears using the arrow keys, but again the update is extremely slow. (Every now and then there is a visible "jump", if that matters.)
For a comparison, I tried running glxgears
on Ubuntu running in a VirtualBox machine. To my surprise, it animates much faster; the gears make a full rotation about once every 4 seconds, compared to once every (maybe 60 seconds but I lost patience) when running under Windows with WSL. This is a big surprise since I'd expect the VirtualBox to be much slower.
On Windows with WSL, glxgears
claims that it is running very fast -- between 800 and 1700 FPS. In VirtualBox glxgears
reports about 900-1000FPS.
Version info on glxgears and OpenGL:
xxxx@DESKTOP-8U2MCOG:~$ glxgears -info
GL_RENDERER = Software Rasterizer
GL_VERSION = 1.4 (2.1 Mesa 19.2.0-devel (git-cdf42f5eaa))
GL_VENDOR = Mesa Project
GL_EXTENSIONS = GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_occlusion_query GL_ARB_texture_env_dot3 GL_ARB_transpose_matrix GL_EXT_draw_range_elements GL_EXT_multi_draw_arrays GL_NV_depth_clamp GL_NV_fog_distance GL_NV_point_sprite GL_SUN_multi_draw_arrays
VisualID 183, 0xb7
20311 frames in 5.0 seconds = 4062.197 FPS
Why is glxgears
running so slow in WSL? If it should rightly be able to run faster, then how do I make that happen?
UPDATE
Based on the answer from @allquixotic below I made another attempt to run with the wgl
option, which I did by leaving that second checkbox "Native opengl" checked. I had tried this before, but it turns out I needed to do this after a reboot for it to take effect. When I run glxgears
with this setup, I get a slightly different readout on the console:
xxxx@DESKTOP-8U2MCOG:~$ glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
23633 frames in 7.5 seconds = 3147.913 FPS
10395 frames in 6.8 seconds = 1529.523 FPS
10395 frames in 6.9 seconds = 1512.829 FPS
Now I'm pretty sure my monitor doesn't run at a vertical scan rate of 1500Hz! So I think this might be an indicator of what's really going on; some weirdness with the indirect rendering system. Also I notice that when I CTRL+C to end the program, the GL Window keeps running and animating for a good 10-11 seconds after I've terminated the program -- and that's if I've only run the program for 3-4 seconds. So I'd have to guess that there are a ton of messages getting queued up, or something like that...?
Focus on a single question. Because of how Superuser works, posts with more than one question are not allowed. To understand better it may be useful to read our Help section. – music2myear – 2019-09-30T01:24:58.730
@music2myear yeah despite Q1-Q2-Q3 above I was making an effort to focus on a single question. Or, more accurately, I am working on a single problem (glxgears runs super slow in Ubuntu under Win10), and the list of questions represents my best way to take this vague problem and focus it into specific questions. As you can tell I found it tricky to focus this problem enough; if you have some suggestions on how to better focus the question I'm asking I'd be happy to have the input. – Mr. Snrub – 2019-09-30T02:08:51.770