I have a working threejs example in which particles are rendered via canvas on to a spherical object using the program function, like this:
var material = new THREE.ParticleCanvasMaterial( {
color: 0xffffff,
program: function ( context ) {
context.beginPath();
context.arc( 0, 0, 1, 0, PI2, true );
context.closePath();
context.fill();
}
} );
for ( var i = 0; i < 1000; i ++ ) {
particle = new THREE.Particle( material );
particle.position.x = Math.random() * 2 - 1;
particle.position.y = Math.random() * 2 - 1;
particle.position.z = Math.random() * 2 - 1;
particle.position.normalize();
particle.position.multiplyScalar( Math.random() * 10 + 600 );
initParticle( particle, i * 10 );
scene.add( particle );
}
However, I'd like to switch to the webGL renderer in order for things to run a little faster, but it doesn't have a program option. It seems like maybe I need to use map, but I'm not sure how. Anybody have any ideas on how to adjust this code to accomplish the same thing with the webGL renderer.