I have now resorted to installing a full X server on the server and run a screen there (i.e. log in a user automatically), whenever the server restarts. Then I can set DISPLAY=:0 before starting R. Not the most elegant solution but it works. Apart from Xvfb not working, I could also not find a VNC server that would do it (tried XF4VNC and TigerVNC).
Thanks for your help anyway! Andreas On Sun, Sep 15, 2013 at 1:18 PM, Duncan Murdoch <[email protected]>wrote: > On 13-09-15 6:02 AM, Andreas Maunz wrote: > >> The other write* options seem to limited to me. I am looking for a way >> to obtain a PS, or at least a PNG, since I develop a web application on >> a server that needs to grab the screenshot and create a written report >> with it. Starting my Xvfb like this: >> >> Xvfb :5 -screen 0 640x480x24 -ac +extension GLX +render -noreset -fbdir >> /tmp/foobar >> >> I can easily run glxgears and obtain nice snapshots of the gears via >> 'xwud -in /tmp/foobar/Xvfb_screen0'. However, it just won't work for >> rgl! Given my test.R script with (taken from the doc of bg()): >> > > That does make it sound like an rgl problem. > > >> library('rgl') >> rgl.open() >> foo<-readline('Enter to cont') >> bg3d("white") >> foo<-readline('Enter to cont') >> rgl.bg <http://rgl.bg>(sphere=TRUE, color=c("black","green"), lit=FALSE, >> >> back="lines" ) >> foo<-readline('Enter to cont') >> rgl.bg <http://rgl.bg>(sphere=TRUE, >> >> texture=system.file("textures/**sunsleep.png", package="rgl"), >> back="filled" ) >> foo<-readline('Enter to cont') >> >> I can skip through the steps and check at each with xwud, but it just >> manages to draw the white background. The two last steps fail >> completely, I only receive a black screen. Sane for plot3d(), for example. >> >> Please help, if you can, it would be quite important to have this >> functionality >> > > I can't reproduce any of this, since I'm working on Windows, a system > without Xvfb, and Mac OSX, where your Xvfb command fails with this error > > _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be > created. > > (followed by a sequence of other errors). So I'd like to fix this, but it > just doesn't look feasible. Perhaps you know some X11 expert who can tell > you what rgl is doing wrong? > > Duncan Murdoch > > >> Thanks >> Andreas >> >> >> >> On Wed, Sep 11, 2013 at 6:19 PM, Duncan Murdoch >> <[email protected] >> <mailto:murdoch.duncan@gmail.**com<[email protected]>>> >> wrote: >> >> 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 >> <[email protected] >> <mailto:murdoch.duncan@gmail.**com<[email protected]> >> > >> <mailto:murdoch.duncan@gmail._**_com >> >> <mailto:murdoch.duncan@gmail.**com <[email protected]>>>> >> 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 >> >> >> >> >> > [[alternative HTML version deleted]] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

