Reputation: 46
I am trying to create a three.js ParticleSystem with the below Code. On my Chrome installed on a Linux host this works perfectly fine, but as soon as I am trying run run it on a Windows Chrome portable i get the following WegGL error on the first rendering call:
WebGL: INVALID_OPERATION: vertexAttribPointer: no bound ARRAY_BUFFER WebGL: INVALID_OPERATION: drawArrays: attribs not setup correctly
... snippet from the shader configuration: ...
'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;',
... Creation of the Particle System ....
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);
}
I have no idea why the VBO is not bound or cannot be bound. The issues i found so far that were related to this topic:
But both seem not to be applicable in my case.
Any help would be highly appreciated ;)
Upvotes: 0
Views: 1983
Reputation: 46
Just for the record:
Removed the "varying vec3 vNormal" from both vertex and fragment shader as it was not used which fixed the problem. However I am curious what makes the behaviour so different on various platforms.
Upvotes: 2