This unique piece of code (inspired by this and this example):
generateCircle = (ctx) ->
position = 0.5
radius = 0.5
ctx.scale(0.05, -0.05)
ctx.beginPath()
ctx.arc(position, position, radius, 0, 2*Math.PI, false)
ctx.fillStyle = 'white'
ctx.fill()
mat = new THREE.SpriteCanvasMaterial( {program: generateCircle } )
sprite = new THREE.Sprite( mat )
encounters an issue
Uncaught TypeError: Cannot read property 'x' of undefined.
At line 36534 in Three.js:
_gl.uniform2f( uniforms.uvScale, material.uvScale.x, material.uvScale.y );
It appears that the uvScale and uvOffset properties of the material are not properly initialized... Why is that? If I manually set these properties:
mat.uvScale = new THREE.Vector2()
mat.uvOffset = new THREE.Vector2()
The errors vanish but the particles are not visible (I am unsure of where to draw on the canvas, and why scaling is necessary).