Skip to content

TextTexture

cjcliffe edited this page Oct 15, 2011 · 2 revisions

CubicVR.TextTexture

Constructor:

TextTexture( text, options )

Parameters:

  • text : A text string, or an array of lines of text.
  • options : Options object.

Options object:

  • options
    • color : Color, HTML format. (default: #fff)
    • bgcolor : Background color, HTML format. (optional)
    • font Font. (default: 18pt Arial)
    • align
    • x
    • y
    • width
    • height

Methods:

update()

clear()

Example usage:

From tests/text/text.html:

var textTexture = new CubicVR.TextTexture(['CubicVR.js', 'Rocks!'], {
   align: 'center',
   font: '18pt Arial'
});

var planeMaterial = new CubicVR.Material({
   color: [0, 0, 1],
   textures: {
      color: textTexture
   }
});

var planeMesh = CubicVR.primitives.plane({
   size: 1.0,
   material: planeMaterial,
   uvmapper: {
      projectionMode: CubicVR.enums.uv.projection.PLANAR,
      projectionAxis: CubicVR.enums.uv.axis.Z,
      scale: [1, 1, 1]
   }
});

planeMesh.triangulateQuads().compile().clean();

var sceneObject = new CubicVR.SceneObject(planeMesh);

scene.bindSceneObject(sceneObject);
Something went wrong with that request. Please try again.