On 27/06/2010 12:58 PM, Matthew Neilson wrote:> Hi there,
>
> I've written a script for reading 3D simulation data into R, rendering
> it using RGL, and then saving the resulting plot using the
> snapshot3d() function. The results are fantastic! However, whenever
> RGL plots anything it automatically brings the viewing window into
> focus. Since I'm producing a large number of plots in a loop, my
> machine becomes almost unusable for the duration of the script.
>
> When producing 2D plots in R (i.e. not using RGL), I can easily call
> the pdf() function before each plot (and then close it with the
> dev.off() function) so that the plot is written directly to a file,
> thus bypassing the display. This allows me to set scripts running in
> the background, so that I can get on with other things. ;)
>
> Is there a way of forcing RGL to draw to an "invisible" (virtual,
or
> buffered?) display that can then be saved using the snapshot3d()
> function?
rgl can't do that, but perhaps your OS can, e.g. you set up an X11
server that doesn't display anything on your screen. I don't know if
that's possible or not.
You can avoid bringing the window to the top by setting the top argument
to FALSE when you call snapshot3d, but what I found when doing this on
many systems was that I got a snapshot showing the overlapping window,
not just the contents of the rgl window. What happens on your system
will depend on your graphics driver.
You might also be able to tell rgl (via r3dDefaults) to open the window
mostly off your screen. I don't know if you'll get a useful snapshot
from it.
Duncan Murdoch