MyNixOS website logo
Description

Shiny Wrappers for RGL.

Shiny wrappers for the RGL package. This package exposes RGL's ability to export WebGL visualization in a shiny-friendly format.

shiny-rgl

Shiny wrapper for the RGL package. This package enables users to create Shiny apps that use interactive 3D graphics in WebGL using the RGL package. The implementation can be as simple as adding lines like the following:

ui.R

...
  # Create an output element (works just like 'plotOutput()')
  webGLOutput("myWebGL")
...

server.R

...
  output$myWebGL <- renderWebGL({
    points3d(1:10, 1:10, 1:10)
    axes3d()
  })
...

And you should see something like the following added to your Shiny app, though it will be interactive as seen here.

3dplot

Installation

You can install the latest version of the code using the devtools R package.

# Install devtools, if you haven't already.
install.packages("devtools")

library(devtools)
install_github("shinyRGL", "trestletech")

# OPTIONAL (see below)
install_github("rgl", "trestletech", "js-class")

The package requires RGL version 0.93.949 or later (which is available on CRAN via install.packages("rgl")). However, some additional functionality has been developed for RGL and submitted as a patch. When this functionality is incorporated, you'll find that the user's adjusted viewpoint of a WebGL scene is persisted between server-side scene generations. For instance, if a user were to zoom in and pan a WebGL scene, then alter the scene by changing some setting, their zoom and pan settings would be unaltered when the scene was regenerated on the server. Hopefully this code wil be integrated into RGL shortly; in the meantime, you can install my patched version of RGL using the following command:

install_github("rgl", "trestletech", "js-class")

That will give you the persistent viewpoint seen here (Try panning and zooming a bit then adjusting the sliders. You'll note that your viewpoint isn't reset.)

Though you don't need much X11 code or even XVFB, you will likely need to install some OpenGL packages in order to compile the rgl package. On Ubuntu, this package is libglu1-mesa-dev.

Running on a Headless Server like EC2

The ability to use a "null device" was recently added to RGL, allowing you to use RGL (thus shinyRGL) on a headless server without having to emulate a framebuffer using XVFB. This is still new code to RGL, however, so there are a few quirks to get it working. Primarily: you'll need to set an option in R using options(rgl.useNULL=TRUE) or set an environment variable named RGL_USE_NULLbefore loading RGL. If you don't do this, you'll see a lot of this error in R:

Warning in rgl.init(initValue, onlyNULL) :
  RGL: unable to open X11 display
Warning in fun(libname, pkgname) : error in rgl_init

or Error: rgl.open failed in your shiny app.

You can either do this explicitly by running the necessary command before loading rgl (as is done in the examples) in your application code, or you can place the command in your .Rprofile file so that it's executed each time you start R, before RGL has a chance to load.

License

The development of this project was generously sponsored by the Institut de Radioprotection et de Sûreté Nucléaire and performed by Jeff Allen. The code is licensed under The MIT License (MIT).

Copyright (c) 2013 Institut de Radioprotection et de Sûreté Nucléaire

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Version

0.1.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows