open3d: Work with RGL windows

View source: R/r3d.rgl.R

open3dR Documentation

Work with RGL windows


open3d opens a new RGL window; cur3d returns the device number of the current window; close3d closes one or more windows.


open3d(..., params = getr3dDefaults(), 
	    useNULL = rgl.useNULL(), silent = FALSE)
close3d(dev = cur3d(), silent = TRUE)

set3d(dev, silent = FALSE)

getr3dDefaults(class = NULL, value = NULL)




arguments in name = value form, or a list of named values. The names must come from the graphical parameters described in par3d.


a list of graphical parameters


whether to use the null graphics device


which device to close or use


whether report on what was done

class, value

names of components to retrieve


open3d opens a new RGL device, and sets the parameters as requested. The r3dDefaults list returned by the getr3dDefaults function will be used as default values for parameters. As installed this sets the point of view to 'world coordinates' (i.e. x running from left to right, y from front to back, z from bottom to top), the mouseMode to (zAxis, zoom, fov), and the field of view to 30 degrees. useFreeType defaults to FALSE on Windows; on other systems it indicates the availability of FreeType. Users may create their own variable named r3dDefaults in the global environment and it will override the installed one. If there is a bg element in the list or the arguments, it should be a list of arguments to pass to the bg3d function to set the background.

The arguments to open3d may include material, a list of material properties as in r3dDefaults, but note that high level functions such as plot3d normally use the r3dDefaults values in preference to this setting.

If useNULL is TRUE, RGL will use a “null” device. This device records objects as they are plotted, but displays nothing. It is intended for use with rglwidget.


The open3d function returns the device that was opened. If silent = TRUE, it is returned invisibly.

The cur3d function returns the current device, or the value 0 if there isn't one.

set3d returns the device number of the previously active device.

The close3d function returns the new current device, invisibly.

The r3dDefaults variable is a list containing default settings. The getr3dDefaults function searches the user's global environment for r3dDefaults and returns the one in the RGL namespace if it was not found there. The components of the list may include any settable par3d parameter, or "material", which should include a list of default material3d properties, or "bg", which is a list of defaults to pass to the bg3d function.

See Also

rgl.useNULL for default usage of null device.


    shade3d(cube3d(color = rainbow(6), meshColor = "faces"))

rgl documentation built on June 10, 2022, 9:05 a.m.