[R] rgl snapshot on headless server

Duncan Murdoch murdoch.duncan at gmail.com
Wed Sep 11 18:19:46 CEST 2013


On 11/09/2013 11:44 AM, Andreas Maunz wrote:
> I am running Xvfb now with
>
> -fbdir /some/path and
> -extension RANDR
>
> but rgl.snapshot is still not working.
>
> Any other idea? Since I can display the webGL successfully in firefox 
> (so comes out correct), I assume there should be some way of 
> converting it on the server side to some (vector) graphic file format?

The .html file that writeWebGL produces could be considered to be that, 
but it's really mostly Javascript code, and I don't know anything other 
than a browser that can display it.  If you look at ?writeWebGL, you'll 
see links to various other ?write* files; they are all vector formats, 
but are all more limited than writeWebGL in what they can record.

Duncan Murdoch

>
> Thanks
> Andreas
>
>
>
> On Tue, Sep 10, 2013 at 6:38 PM, Duncan Murdoch 
> <murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote:
>
>     On 10/09/2013 10:58 AM, Andreas Maunz wrote:
>
>         Hi all,
>
>         I have a shiny app, in which I want to use rgl's snapshot
>         function. I am
>         running Xvfb on my server so that rgl works. I start my shiny
>         app as
>         follows:
>
>         echo "Checking for Xvfb..."
>         pgrep -U username Xvfb > /dev/null 2>&1
>
>         if [ "$?" -gt 0 ]; then
>            echo "Starting Xvfb..."
>            Xvfb :7 -screen 0 1280x1024x24 &
>            sleep 2
>         fi
>
>         echo "...starting shiny"
>         export DISPLAY=":7"; R --no-save --no-restore -e
>         "library('shiny');
>         runApp('/path/to/app', port=8101)"
>
>         In the app, I do plot3d(), generate webGL and send the results
>         to the
>         browser. But the rgl.snapshot or rgl.postscript functionality
>         do not work,
>         i.e. they produce black or empty images. I assume this is due
>         to Xvfb. Any
>         chance I can create snapshots?
>
>
>     rgl.snapshot requires the X server to maintain a frame buffer that
>     it can read.   It looks as though something is going wrong with
>     yours.  I don't use a system with Xvfb, so I can't really help,
>     but you could try Googling to see if that turns anything up.
>
>     rgl.postscript shouldn't need the X server, but it is limited in
>     what it can display.
>
>     Duncan Murdoch
>
>



More information about the R-help mailing list