在三个JS中使用imageData作为纹理

时间:2012-11-22 15:39:19

标签: three.js texture-mapping

我尝试加载imageData以在threeJS中创建纹理。 我尝试这样,但它不起作用。

pMaterial =
new THREE.ParticleBasicMaterial({
    color: 0xFFFFFF,
    size: 20,
    map: THREE.DataTexture(
        myimageData
        ),
    blending: THREE.AdditiveBlending,
    transparent: true
});

感谢您的帮助。

1 个答案:

答案 0 :(得分:3)

它适用于以下代码。

var texture = new THREE.Texture(myImageData);
texture.needsUpdate = true;

particles = new THREE.Geometry(),
pMaterial =
new THREE.ParticleBasicMaterial({
    size: 20,
    map: texture,
    blending: THREE.AdditiveBlending,
    transparent: true
});