2012-11-22 123 views
0

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

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

感谢您的帮助。

+3

请定义“不起作用”的意思...... –

回答

1

它适用于下面的代码。

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 
}); 
+0

重要的部分是'texture.needsUpdate = true;'。没有它,纹理就会变成黑色。 – Kyopaxa