rgl.snapshot

0th

Percentile

export screenshot

Saves the screenshot as png file.

Keywords
dynamic
Usage
rgl.snapshot( filename, fmt = "png", top = TRUE )
snapshot3d( ... )
Arguments
filename

full path to filename.

fmt

image export format, currently supported: png

top

whether to call rgl.bringtotop

...

arguments to pass to rgl.snapshot

Details

Animations can be created in a loop modifying the scene and saving each screenshot to a file. Various graphics programs (e.g. ImageMagick) can put these together into a single animation. (See movie3d or the example below.)

Note

On some systems, the snapshot will include content from other windows if they cover the active rgl window. Setting top = TRUE (the default) will use rgl.bringtotop before the snapshot to avoid this.

See Also

movie3d, rgl.viewpoint

Aliases
  • rgl.snapshot
  • snapshot3d
Examples
# NOT RUN {
# }
# NOT RUN {
#
# create animation
#

shade3d(oh3d(), color = "red")
rgl.bringtotop()
rgl.viewpoint(0, 20)

olddir <- setwd(tempdir())
for (i in 1:45) {
  rgl.viewpoint(i, 20)
  filename <- paste("pic", formatC(i, digits = 1, flag = "0"), ".png", sep = "")
  rgl.snapshot(filename)
}
## Now run ImageMagick in tempdir().  Use 'convert' instead of 'magick'
## if you have an older version of ImageMagick:
##    magick -delay 10 *.png -loop 0 pic.gif
setwd(olddir)
# }
# NOT RUN {
# }
Documentation reproduced from package rgl, version 0.100.50, License: GPL

Community examples

cron-weasley@hotmail.com at May 15, 2018 rgl v0.99.16

library(rgl) par3d(windowRect=c(384,59,1358,852),zoom=0.8) rgl.viewpoint(0,0,fov=0) shapes <- list(Tetrahedron = tetrahedron3d(), Cube = cube3d(), Octahedron = octahedron3d(),Icosahedron = icosahedron3d(), Dodecahedron = dodecahedron3d(),Cuboctahedron = cuboctahedron3d()) col <- rainbow(6) for (i in 1:6){ shade3d(shapes[[i]], col = col[i]) rgl.snapshot(paste(i,".png",sep="")) rgl.clear() }