Skip to content

Instantly share code, notes, and snippets.

@rossmeissl
Created December 5, 2011 17:46
Show Gist options
  • Save rossmeissl/1434529 to your computer and use it in GitHub Desktop.
Save rossmeissl/1434529 to your computer and use it in GitHub Desktop.
Canvas element as mesh material
var canvas = document.createElement('canvas', { style: "background: none" });
canvas.width = 400;
canvas.height = 25;
var context = canvas.getContext('2d');
context.fillStyle = 'blue';
context.fillText(labelText, 0, 0);
var material = new THREE.MeshBasicMaterial(canvas);
var geometry = new THREE.PlaneGeometry(400,25);
var plane = new THREE.Mesh( geometry, material);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment