cesium1.102.0及以上版本自定义GLSL报“texture2D‘ : no matching overloaded function found”错误

cesium1.102.0及以上版本自定义GLSL报“texture2D‘ : no matching overloaded function found”错误_第1张图片

问题所在

cesium1.102.0以上版本将不再使用webGL1进行上下文渲染版本改为webgl2版本,导致不在兼容‘texture2D’。

解决方法(3个方法)

1、将cesium降为100以下版本(不建议感觉意义不大)
2、将现在的版本改为webGL1使用(有一定的限制因素)
new Viewer('cesiumContainer', {
  contextOptions: {
    requestWebgl1: true,
  }
})
3、将自定义glsl中“texture2D”改为“texture”
vec4 colorImage = texture2D(image, vec2(fract(st.t - time), st.t));
改为
vec4 colorImage = texture(image, vec2(fract(st.t - time), st.t));

你可能感兴趣的:(cesium,cesium,前端,javascript)