【发布时间】:2016-07-07 21:27:16
【问题描述】:
我有一张Canvas 地图(纹理):
var mesh;
var canvas = document.createElement('canvas');
var context= canvas.getContext("2d");
context.canvas.width = context.canvas.height = 128;
context.fillStyle = 'rgba(255,255,255,0.4)';
context.fillText('lala', 64, 85);
var texture = new THREE.Texture(canvas);
texture.needsUpdate = true;
var material = new THREE.PointsMaterial( { size: 128, map: texture } );
var geometry = new THREE.Geometry();
geometry.vertices.push( new THREE.Vector3() );
mesh = new THREE.Points( geometry, material );
scene.add(mesh);
如何通过网格对象引用到达上下文以更新它?
mesh.material.map.image....context?? ... ? what is the correct approach?
【问题讨论】:
-
你会很丑,并且在处理和更新这个数组时会产生另一个问题
-
context= o.material.map.image.getContext("2d"); ?它有效,但这可以吗?
-
也许可以解释一下您要做什么以及为什么再次需要上下文。
-
在每一帧中更新它,并防止在内存中存储旧的上下文和旧的纹理
标签: javascript canvas three.js