threejs (version 0.3.1)

texture: Convert an image file or uri to a three.js texture

Description

Convert file image representations in R into JSON-formatted arrays suitable for use as three.js textures. This function is automatically invoked for images used in the globejs function.

Usage

texture(data)

Arguments

data

A character string file name referring to an image file, or referring to an image uri (see the examples).

Value

JSON-formatted list with image, width, and height fields suitable for use as a three.js texture created with the base64texture function. The image field contains a base64 dataURI encoding of the image.

References

The threejs project http://threejs.org. https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally.

Examples

Run this code
# NOT RUN {
# A big image (may take a while to download):
img <- paste("http://eoimages.gsfc.nasa.gov/",
             "images/imagerecords/73000/73909/",
             "world.topo.bathy.200412.3x5400x2700.jpg", sep="")
t <- texture(img)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab