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

Dr Gregory Jefferis jefferis at mrc-lmb.cam.ac.uk
Wed Dec 30 22:42:54 CET 2015


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 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')) && 
(DEVTOOLS_CRAN || CRAN)){
     options(rgl.useNULL=TRUE)
   }

}

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