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

Duncan Murdoch murdoch.duncan at gmail.com
Wed Dec 30 22:11:05 CET 2015


On 30/12/2015 3:54 PM, Dr Gregory Jefferis wrote:
> Dear Duncan,
>
> On 8 Oct 2015, at 22:10, Duncan Murdoch wrote:
>
>> On 08/10/2015 4:41 PM, Dr Gregory Jefferis wrote:
>
> [snip]
>
>>> I have a package which imports rgl i.e. rgl is loaded on package
>>> startup. A number of examples (not tests) use rgl features and I do
>>> not
>>> want these to be run on CRAN.
>>>
>>> Is there a way to configure rgl.useNULL to handle this situation?
>>>
>>
>> I don't think so, but I don't think you really want that.
>>
>> options(rgl.useNULL = TRUE)
>>
>> doesn't stop rgl from running, it just stops it from trying to display
>> anything.  So you could put code like
>>
>> if (!interactive())
>> options(rgl.useNULL = TRUE)
>>
>> into your .onLoad function for your package, and it wouldn't try to
>> open
>> a display on CRAN, or anywhere else that wasn't interactive.
>
> I tried following this suggestion, but this has the unintended (for me)
> consequence that it is no longer possible to get rgl snapshots e.g. in
> knitr when rgl.useNULL=TRUE? From what I can see writeWebGL works fine
> but snapshot3d does not and this is not quite what I was expecting
> (though it seems fair enough in retrospect).
>
> Is there a workaround to get snapshots out of a RGL null display?

No.  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.

>
> 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.

Duncan Murdoch

>
> With many thanks,
>
> Greg.
>
>
>> sessionInfo()
> R version 3.2.3 (2015-12-10)
> Platform: x86_64-apple-darwin13.4.0 (64-bit)
> Running under: OS X 10.9.5 (Mavericks)
>
> locale:
> [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] nat.nblast_1.6.1 catmaid_0.6      httr_1.0.0       nat_1.8.1
> rgl_0.95.1435    devtools_1.9.1
>
> loaded via a namespace (and not attached):
>    [1] Rcpp_0.12.2        formatR_1.2.1      plyr_1.8.3
> nabor_0.4.6        tools_3.2.3
>    [6] nat.utils_0.5.1    digest_0.6.8       jsonlite_0.9.19
> memoise_0.2.1      filehash_2.3
> [11] igraph_1.0.1       curl_0.9.4         yaml_2.1.13        spam_1.3-0
>           stringr_1.0.0
> [16] knitr_1.11         dendroextras_0.2.1 grid_3.2.3         R6_2.1.1
>           rmarkdown_0.7
> [21] magrittr_1.5       codetools_0.2-14   htmltools_0.2.6
> rsconnect_0.3.79   stringi_1.0-1
>
>
>
>
>
> --
> 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