rgl icon indicating copy to clipboard operation
rgl copied to clipboard

rgl very slow with R >= 4.0

Open dalemaitre opened this issue 2 years ago • 3 comments

I am running the 32-bits version of Windows 10. Since I updated R to the version 4.0, the RGL device doesn't work properly: it responds very slowly to the left mouse button (trackball). Other mouse actions work properly until I try to use the left button.

rgl works properly for any R versions before 4.0 (3.5.2, 3.6.0 to 3.6.3) and doesn't work properly for all versions from R 4.0 (4.0.0 to 4.0.5, 4.1.1). It seems independent from the rgl version: for R < 4.0 all rgl versions work properly (the most recent I was able to install is 0.106.8), whereas for R >= 4.0 no rgl version works, including the most recent one (0.107.14). It doesn't depend on RStudio either.

dalemaitre avatar Sep 09 '21 14:09 dalemaitre

I don't have access to a 32 bit version of Windows 10, so you're going to need to do most of the debugging here. If you are able to build rgl from source, you might try installing some older versions to see if this was triggered by some rgl change. Otherwise I can't think of what to suggest.

You should be aware that R is dropping support for 32 bit Windows with the 4.2.0 release next year, so it might be easiest in the long run to update your Windows version to 64 bits (if your hardware supports that), or switch to Linux if it doesn't. Or just stick with R 3.6.3 as long as possible.

dmurdoch avatar Sep 09 '21 16:09 dmurdoch

Re sticking with R 3.6.3: I intend to support that version for another 2 years or more, and I think the tidyverse packages also plan for that much back compatibility, but you will miss out on a lot of changes and bug fixes in R itself.

dmurdoch avatar Sep 09 '21 16:09 dmurdoch

Hi,

Thanks for your answer.

I have already tried to install several versions of rgl (0.100.19, 0.106.8, 0.107.14), but for none of them the trackball works properly with R 4.0.0 and 4.1.1. So I guess there is some incompatibilities between the RGL device and R >= 4.0, at least for the 32-bits version, but I don't know whether the bug comes from R or from rgl.

However, I have just discovered that if, instead of directly using the functions 'plot3d', 'points3d', 'shape3d' etc., I first use the functions 'layout3d' or 'mfrow3d' before adding 3d elements, then all functions work perfectly well for R >= 4.0. It still works if I use the function 'open3d' before the function 'layout3d'. Therefore, the bug might be fixed in rgl by changing default display settings for the RGL device.

If people face the same problem as I do, they can write one of the following scripts before the first 3d element they want to plot in the RGL device (it is possible to set graphical parameters with 'open3d' before the script): mfrow3d(1,1) # first option layout3d(matrix(1,1,1)) # second option

If this bug can't be fixed, I guess it would be good to add this trick somewhere in the description of the package.

dalemaitre avatar Sep 10 '21 10:09 dalemaitre