Skip to contents

Clear the current rgl device or open a new one (if there are no devices or if open = TRUE). Additionally assign the middle button to zoom (via setmousemode()) and the right button to panning (via pan3d()).

Usage

new3d(open = FALSE, clear = "all", ...)

Arguments

open

if TRUE a new rgl device is opened.

clear

rgl stack(s) to remove, see argument type in rgl::clear3d() (used only if there is an active device and open = FALSE). Defaults to "all", with a new light source added to the scene.

...

additional arguments, passed to rgl::open3d() or rgl::clear3d().

Value

Called for its side effect (opens or clears the rgl device, and configures the mouse mode); invisibly returns the current device.

Examples

library(rgl)
# New rgl device
new3d()
shade3d(volcanom, col = "lightgreen")
# Use the right mouse button to panning and the middle button to zoom
# ...
# Clear the current device
new3d()
sshade3d(volcanom, s = volcanom$vb[3, ], meshColor = "facesvertices",
         col = terrain.colors(128))