Sorry if this is a Noob question.
I've been trying to add labels to a timeline created in three.js using dynamically generated canvas elements as sprites. The timeline part is rendering great, but I am having difficulty getting the canvas sprites to render. This is what i'm using for the sprites (taken out of the context of the larger scene):
var canvas = document.createElement('canvas');
var size = 250;
canvas.width = size;
canvas.height = size;
var context = canvas.getContext('2d');
context.fillStyle = '#990000';
context.textAlign = 'center';
context.font = '24px Arial';
context.fillText("some text", size / 2, size / 2);
var amap = new THREE.Texture(canvas);
amap.needsUpdate = true;
var mat = new THREE.SpriteMaterial({
map: amap,
transparent: false,
useScreenCoordinates: false,
color: 0x000000
});
var sp = new THREE.Sprite(mat);
scene.add(sp);
You can see a fuller set of example code here: http://jsfiddle.net/rgE2j/2/.
Any help at all is appreciated.
Thanks, peter