rgl (version 0.67-2)

rgl.snapshot: export screenshot

Description

Saves the screenshot as png file.

Usage

rgl.snapshot( filename, fmt="png" )

Arguments

filename
full path to filename.
fmt
image export format, currently supported: png

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 example below)

See Also

rgl.viewpoint

Examples

Run this code
#
# create animation
#

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

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 command:
##    convert -delay 10 *.png -loop 0 pic.gif

Run the code above in your browser using DataLab