In RStudio the following code will display a 3D plot in a shiny app and also in a separate RGL device. Everything works as expected when axes are not displayed.
When axes are displayed and when I try to move the 3D object, all the 3D points vanish in the shiny viewer (but all is fine in the separate RGL window, suggesting a problem with shiny).
This strange behavior occurs only when I run this code on a remote machine using a VNC connection via SSH, or just when I forward X11 over SSH. The code works well on my local machine, running the exact same versions of R (3.4.1), Rstudio (1.1.383), RGL (0.98.22) and Shiny (1.0.4).
Is there some kind of low level (X11/OpenGL-related?) parameter I could tweak in RStudio/Shiny to fix this ?
options(rgl.useNULL = FALSE) # this is intentional
library(rgl) # 0.98.22
library(shiny) # 1.0.4
app = shinyApp(
ui = bootstrapPage(checkboxInput("axes", "axes"),
rglwidgetOutput("rglPlot")),
server = function(input, output) {
output$rglPlot <- renderRglwidget({
try(rgl.close(), silent = TRUE)
if (input$axes) axes3d()
points3d(rnorm(100),rnorm(100),rnorm(100))
rglwidget()
})
}
)
EDIT & ANSWER
I happens the remote machine, despite having the same version of R and R packages, did not have the same version of Linux the mesa 3D library (it's an AWS-based Linux AMI, locked at the 2017.03 version)
The fix was to run :
yum install mesa-libGL-devel-17.1.5-2.41.amzn1.x86_64