Bio3D-web screenshots are blank

Issue #394 resolved
Shashank Jariwala created an issue

rgl.snapshot is producing blank / black images. The shiny-server / VM has the patched version of shinyRGL (see below). However, the problem could be just between rgl package and xvfb (virtual X server).

require(rgl)
require(shinyRGL)
example(plot3d)
rgl.snapshot('test.png')
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.8 (Santiago)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] shinyRGL_0.1.1 rgl_0.93.963

Comments (8)

  1. Barry Grant

    The solution to our shinyRGL problems might be the rglwidget package.

    Here is some demo code:

    library(rgl)
    library(rglwidget)
    library(htmltools)
    
    theta <- seq(0, 6*pi, len=100)
    xyz <- cbind(sin(theta), cos(theta), theta)
    lineid <- plot3d(xyz, type="l", alpha = 1:0, 
                 lwd = 5, col = "blue")["data"]
    
    browsable(tagList(
    rglwidget(elementId = "example", width = 500, height = 400,
            controllers = "player"),
    playwidget("example", 
             ageControl(births = theta, ages = c(0, 0, 1),
                        objids = lineid, alpha = c(0, 1, 0)),
                        start = 1, stop = 6*pi, step = 0.1, 
                        rate = 6,elementId = "player")
    ))
    

    This produces a WebGL version of an ‘rgl’ scene using the ‘htmlwidgets’ framework. This allows display of the scene in an ‘rmarkdown’ document or in a ‘shiny’ app.

    In a ‘shiny’ app, there will often be one or more ‘playwidget’ objects in the app, taking input from the user. In order to be sure that the initial value of the user control is reflected in the scene, you should list all players in the ‘controllers’ argument. See the sample application in ‘system.file(“shinyDemo”, package = “rglwidget”)’ for an example.

    See: http://www.htmlwidgets.org/showcase_rglwidget.html

  2. Barry Grant

    I was testing on an old Ubuntu system and rgl.snapshot() created an empty black picture with the default graphics driver like those in your report.

    A workaround was to save the 3D view as a postscript file (using rgl.postscript() with .eps output) and then convert it to png (with convert -flatten mypic.eps mypic.png ). This would be better than using pymol perhaps. A better solution was to change the graphics driver.

    So does rgl.postscript() work on the server for this workaround? You might need the GL2PS is a C library installed. Or have you experimented with a different driver?

  3. Shashank Jariwala reporter

    rgl.postscript was also giving blank outputs (for both eps and pdf formats) on the VM. I'll check the library you mentioned and post back. Edit: Did you set options(rgl.useNULL) to TRUE or FALSE? (Both still blank outputs on VM)

  4. Log in to comment