[R-pkg-devel] how to make "r-release-osx-x86_64-mavericks" machine support rgl 3D plots

Duncan Murdoch murdoch.duncan at gmail.com
Thu Dec 31 01:28:38 CET 2015

On 30/12/2015 4:42 PM, Dr Gregory Jefferis wrote:
> On 30 Dec 2015, at 21:11, Duncan Murdoch wrote:
>>> Is there a workaround to get snapshots out of a RGL null display?
>> No.
> OK. Thanks for confirming.
>> Theoretically it's possible to use a virtual frame buffer in X11 to
>> hold the image, but I've got no experience with that myself.
> I have used xvfb in some headless environments (including travis).
>>> If not, I think I am back to square 1 in terms of trying to figure
>>> out
>>> how to suppress rgl *examples* (tests are easy) on CRAN.
>> You can test for a null device using rgl.useNULL().  If that is true,
>> don't try to produce a snapshot.
> I wasn't being clear there. I want to have rgl example code (e.g. plot3d
> statements) in my documentation
> * that's not enclosed in conditionals
> * or \dontrun
> * but that doesn't use a live rgl window during package check
> (especially on CRAN)
> * ... unless I do something to request this.
> The code is not actually making snapshots.

I'm not sure I understand why.  Why not write examples that produce rgl 
displays (or nothing with a null device)?  rgl itself has lots of these, 
and passes checks on most systems.  Currently it is supposed to detect 
display initialization failures and fall back to the null device, but I 
don't know if this works on the only CRAN system that seems to need it, 
the OSX system, because I haven't seen results of tests yet.

> I think what I may try is changing my .onLoad to look something like
> this:
> .onLoad <- function(libname, pkgname) {
>     DEVTOOLS_CRAN=toupper(Sys.getenv("NOT_CRAN")) %in% c("FALSE","0",
> "NO")
>     # this is a heuristic to determine if we are running on CRAN
>     CRAN=toupper(Sys.getenv("_R_CHECK_INSTALL_DEPENDS_")) %in% c("TRUE",
> "YES", "1")
>     if(!interactive() && is.null(getOption('rgl.useNULL')) &&
>       options(rgl.useNULL=TRUE)
>     }
> }

I would be careful about that -- the CRAN people want to run realistic 
tests, and they will likely object if you are trying to act differently 
on their system than on your users' systems.

Duncan Murdoch

> Thanks again,
> Greg.
> --
> Gregory Jefferis, PhD
> Division of Neurobiology
> MRC Laboratory of Molecular Biology
> Francis Crick Avenue
> Cambridge Biomedical Campus
> Cambridge, CB2 OQH, UK
> http://www2.mrc-lmb.cam.ac.uk/group-leaders/h-to-m/g-jefferis
> http://jefferislab.org
> http://flybrain.stanford.edu

More information about the R-package-devel mailing list