Hi there,
I defined the shader using version 1.105 of cesium and received the following error
RuntimeError: Fragment shader failed to compile. Compile log: ERROR: 0:35: 'czm_translucentPhong' : no matching overloaded function found
ERROR: 0:35: '=' : dimension mismatch
ERROR: 0:35: 'assign' : cannot convert from 'const mediump float' to 'out highp 4-component vector of float'
Error
at new RuntimeError (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:8037:11)
at createAndLinkProgram (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:16089:9)
at reinitialize (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:16227:19)
at initialize2 (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:16222:3)
at ShaderProgram._bind (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:16267:3)
at beginDraw (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:26155:17)
at Context.draw (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:26206:3)
at DrawCommand.execute (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:13771:11)
at executeCommand (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:161234:13)
at executeTranslucentCommandsSortedMRT (http://192.168.1.64:9527/node_modules/.vite/cesium.js?v=6e10d7c2:151486:5)
The following is my definition of the Fragment shader
const getFragmentShaderSource = function () {
return "#version 300 es\n\
in vec3 v_position;\n\
in vec3 v_normal; \n\
uniform float picked; \n\
uniform vec4 pickedColor; \n\
uniform vec4 defaultColor; \n\
uniform float specular; \n\
uniform float shininess; \n\
uniform vec3 emission; \n\
in vec2 v_st; \n\
uniform bool isLine; \n\
uniform float glowPower; \n\
layout(location=2) out vec4 pc_FragColor; \n\
void main() { \n\
vec3 positionToEyeEC = -v_position; \n\
vec3 normalEC = normalize(v_normal); \n\
vec4 color = defaultColor; \n\
if (picked != 0.0) { \n\
color = pickedColor; \n\
} \n\
czm_material material; \n\
material.specular = specular; \n\
material.shininess = shininess; \n\
material.normal = normalEC; \n\
material.emission = emission;//vec3(0.2,0.2,0.2);\n\
material.diffuse = color.rgb ;\n\
if(isLine){\n\
material.alpha = 1.0; \n\
}\n\
else{ \n\
material.alpha = color.a; \n\
}\n\
if(v_st.x==0.0){ \n\
pc_FragColor =color ;\n\
}else { \n\
pc_FragColor = czm_phong(normalize(positionToEyeEC), material) ; \n\
} \n\
}"
}
The following is my definition of the Vertex shader
const getVertexShaderSource = function () {
return "#version 300 es\n\
#ifdef GL_ES\n\
precision highp float;\n\
#endif\n\n\
in vec3 position;\n\
in vec2 st;\n\
in vec3 normal;\n\
uniform mat4 modelViewMatrix;\n\
uniform mat3 normalMatrix;\n\
uniform mat4 projectionMatrix;\n\
out vec3 v_position;\n\
out vec3 v_normal;\n\
out vec2 v_st;\n\n\
out vec3 v_light0Direction;\n\n\
void main(void) \n\
{\n\
vec4 pos = modelViewMatrix * vec4( position,1.0);\n\
v_normal = normalMatrix * normal;\n\
v_st = st;\n\
v_position = pos.xyz;\n\
v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);\n\
gl_Position = projectionMatrix * pos;\n\
}"
}
Who can help me? I’ve been searching for it for a long time and I don’t know where the mistake is.