在用threejs加载gltf模型时候发现有的glb文件无法加载会报错如下
vconsole.min.js:10 THREE.WebGLProgram: Shader Error 0 - VALIDATE_STATUS false
Program Info Log: Vertex shader is not compiled.
VERTEX
ERROR: 0:307: 'textureSize' : no matching overloaded function found
ERROR: 0:307: 'x' : field selection requires structure or vector on left hand side
ERROR: 0:307: '=' : cannot convert from 'const mediump float' to 'highp int'
ERROR: 0:309: '%' : integer modulus operator supported in GLSL ES 3.00 and above only
ERROR: 0:311: 'texelFetch' : no matching overloaded function found
ERROR: 0:311: '=' : dimension mismatch
ERROR: 0:311: '=' : cannot convert from 'const mediump float' to 'highp 4-component vector of float'
ERROR: 0:312: 'texelFetch' : no matching overloaded function found
ERROR: 0:312: '=' : dimension mismatch
ERROR: 0:312: '=' : cannot convert from 'const mediump float' to 'highp 4-component vector of float'
ERROR: 0:313: 'texelFetch' : no matching overloaded function found
ERROR: 0:313: '=' : dimension mismatch
ERROR: 0:313: '=' : cannot convert from 'const mediump float' to 'highp 4-component vector of float'
ERROR: 0:314: 'texelFetch' : no matching overloaded function found
ERROR: 0:314: '=' : dimension mismatch
ERROR: 0:314: '=' : cannot convert from 'const mediump float' to 'highp 4-component vector of float'
302: #ifdef USE_SKINNING
303: uniform mat4 bindMatrix;
304: uniform mat4 bindMatrixInverse;
305: uniform highp sampler2D boneTexture;
306: mat4 getBoneMatrix( const in float i ) {
> 307: int size = textureSize( boneTexture, 0 ).x;
308: int j = int( i ) * 4;
309: int x = j % size;
310: int y = j / size;
311: vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
312: vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
313: vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
解决方法把160版本的threejs改为146版本
=========================================================
10.29更新
调整为146版本后依然会有glb模型加载不出来的问题,看了下开发者回答的相关问题,问题是threejs越新的版本对web gl1的支持越弱,而由于项目的原因WebGLRenderer的context上下文必须是webgl1的(高德,说的就是你), 所以将版本调成130后暂时解决了(不知道以后还会不会有问题),有更好的解决方法请各位大神告诉我,谢谢!