Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

writeWebGL

Write scene to HTML (obsolete)


Description

Obsolete function to write the current scene to a collection of files that contain WebGL code to reproduce it in a browser. Please use rglwidget instead.

Usage

writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"), 
           template = system.file(file.path("WebGL", "template.html"), package = "rgl"),
           prefix = "",
           snapshot = TRUE, commonParts = TRUE, reuse = NULL, 
           font = "Arial", width, height)

Arguments

dir

Where to write the files.

filename

The filename to use for the main file.

template

The template web page to which to write the Javascript for the scene. See Details below.

prefix

An optional prefix to use on global identifiers in the scene; use different prefixes for different scenes displayed on the same web page. If not blank, it should be a legal identifier in Javascript and HTML.

snapshot

Whether to include a snapshot of the scene, to be displayed in browsers that don't support WebGL, or a specification of the snapshot to use. See details below.

commonParts

Whether to include parts that would be common to several figures on the same page. Currently this includes a reference to and copy of the ‘CanvasMatrix.js’ file in the output.

reuse

Ignored.

font

The font to use for text.

width, height

The (optional) width and height in pixels of the image to display. If omitted, the par3d("windowRect") dimensions will be used.

Details

This obsolete function writes out a web page containing Javascript that reconstructs the scene in WebGL. It will be formally deprecated in an upcoming release; you should use rglwidget instead in any new code, and start migrating old code there.

The remaining documentation has been removed to discourage use of this function.

Value

The filename is returned.

Note

If commonParts is TRUE, the output includes a binary copy of the CanvasMatrix Javascript library. Its source (including the copyright notice and license for free use) is included in the file named by system.file("htmlwidgets/lib/CanvasMatrix.src.js", package = "rgl").

Author(s)

Duncan Murdoch.

See Also

rglwidget should be used instead of writeWebGL. Other functions which are related: scene3d saves a copy of a scene to an R variable; writeASY, writePLY, writeOBJ and writeSTL write the scene to a file in various other formats.


rgl

3D Visualization Using OpenGL

v0.106.8
GPL
Authors
Duncan Murdoch [aut, cre], Daniel Adler [aut], Oleg Nenadic [ctb], Simon Urbanek [ctb], Ming Chen [ctb], Albrecht Gebhardt [ctb], Ben Bolker [ctb], Gabor Csardi [ctb], Adam Strzelecki [ctb], Alexander Senger [ctb], The R Core Team [ctb, cph], Dirk Eddelbuettel [ctb], The authors of Shiny [cph], The authors of knitr [cph], Jeroen Ooms [ctb], Yohann Demont [ctb], Joshua Ulrich [ctb], Xavier Fernandez i Marin [ctb], George Helffrich [ctb], Ivan Krylov [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.