2012-07-06 4 views
0

아래 코드로 three.js ParticleSystem을 생성하려고합니다.three.js ParticleSystem 생성 : INVALID_OPERATION : 바인딩되지 않음 BUFFER_ARRAY

WebGL을 : INVALID_OPERATION이 최대한 빨리 내가 ​​처음 렌더링 호출에서 다음 WegGL 오류가 윈도우 크롬 휴대용에 실행을 실행하려으로하지만, 완벽하게 잘 작동 리눅스 호스트에 설치된 내 크롬에 : vertexAttribPointer : INVALID_OPERATION : drawArrays : attribs하지 설치 제대로

... 쉐이더 구성에서 니펫을 : 더 ARRAY_BUFFER에게 WebGL에 바인딩하지 ...

'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가 바인드되지 않았거나 준수 할 수없는 이유를 모르겠어요. 이 주제에 관한 한 내가 지금까지 발견 된 문제 :

  1. https://github.com/mrdoob/three.js/issues/1985
  2. https://github.com/mrdoob/three.js/issues/2073

하지만 모두가 내 경우에는 적용 할 수없는 것 같다.

어떤 도움은 매우 극명하게 될 것이다, 그냥 레코드)

답변

2

:

이이 문제를 해결하는 사용하지되었을 때 모두 정점과 프래그먼트 쉐이더에서 "vNormal VEC3 변화"제거. 그러나 다양한 플랫폼에서 동작이 매우 다른 이유가 궁금합니다.