0
我正在嘗試使用下面的代碼創建three.js ParticleSystem。 在我的Chrome安裝在Linux主機這個只要我試圖在Windows的Chrome便攜式我得到第一個渲染調用以下WegGL錯誤運行來看,這工作完全正常,但:three.js ParticleSystem創建提供INVALID_OPERATION:not bound BUFFER_ARRAY
的WebGL:INVALID_OPERATION :vertexAttribPointer:沒有約束ARRAY_BUFFER 的WebGL:INVALID_OPERATION:drawArrays:attribs沒有設置正確
...從着色器配置片段:...
'particle' : {
uniforms: {
now: {
type: 'f',
value: 0
},
hitstart: {
type: 'f',
value: RADIUS
},
hitend: {
type: 'f',
value: RADIUS/10
},
texture: {
type: "t",
value: 0,
texture: THREE.ImageUtils.loadTexture("img/particle.png")
},
color: {
type: 'v4',
value: particleColorToVector(this.particleColor,this.particleIntensity)
}
},
attributes: {
longitude: {
type: 'f',
value: []
},
latitude: {
type: 'f',
value: []
},
longitude_d: {
type: 'f',
value: []
},
latitude_d: {
type: 'f',
value: []
},
created: {
type: 'f',
value: []
},
lifetime: {
type: 'f',
value: []
},
size: {
type: 'f',
value: []
}
}, vertexShader: [
'uniform float now;',
'uniform float hitstart;',
'uniform float hitend;',
'attribute float created;',
'attribute float lifetime;',
'attribute float longitude;',
'attribute float latitude;',
'attribute float longitude_d;',
'attribute float latitude_d;',
'attribute float size;',
'attribute float height;',
'varying vec3 vNormal;',
'varying float age;',
...創建粒子系統....
function buildParticles() {
var shader = shaders['particle'];
var longs = shader.attributes.longitude.value;
var lats = shader.attributes.latitude.value;
var destx = shader.attributes.longitude_d.value;
var desty = shader.attributes.latitude_d.value;
var lifetimes = shader.attributes.lifetime.value;
var created = shader.attributes.created.value;
var sizes = shader.attributes.size.value;
particles = new THREE.Geometry();
for (var i = 0; i < particle_count;i++) {
particles.vertices.push(new THREE.Vector3(0,0,0));
longs.push(degree_to_radius_longitude(0));
lats.push(degree_to_radius_latitude(0));
created.push(tic);
destx.push(degree_to_radius_longitude(0));
desty.push(degree_to_radius_latitude(0));
lifetimes.push(0);
sizes.push(0);
}
var material = new THREE.ShaderMaterial ({
uniforms: shader.uniforms,
attributes: shader.attributes,
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader,
transparent: true,
blending: THREE.AdditiveBlending,
depthTest: true
});
particleSystem = new THREE.ParticleSystem(
particles,
material
);
scene.add(particleSystem);
}
我不知道爲什麼VBO沒有綁定或不能綁定。 我迄今爲止所發現的問題,那名與此相關的話題:
但兩者似乎並不適用於我的情況。
任何幫助,將不勝感激)