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.

returns a vector of all open devices. Items are named according to the type of device: null for a hidden null device, wgl for a Windows device, and glX for an X windows device.

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.

rgl.quit attempts to unload rgl and then returns

NULL invisibly.

See also

rgl.useNULL for default usage of null device.


#> $userMatrix
#>      [,1]       [,2]      [,3] [,4]
#> [1,]    1  0.0000000 0.0000000    0
#> [2,]    0  0.3420201 0.9396926    0
#> [3,]    0 -0.9396926 0.3420201    0
#> [4,]    0  0.0000000 0.0000000    1
#> $mouseMode
#> [1] "none"      "trackball" "zoom"      "fov"       "pull"     
#> $FOV
#> [1] 30
#> $bg
#> $bg$color
#> [1] "white"
#> $bg$fogtype
#> [1] "none"
#> $family
#> [1] "sans"
#> $material
#> $material$color
#> [1] "black"
#> $material$fog
#> [1] TRUE
    shade3d(cube3d(color = rainbow(6), meshColor = "faces"))

#> null 
#>   65