大家好,我最近正在学习使用cocos creator3.8.6版本,我用ai帮我写了一个effect,在编辑器中能正常看到效果。但是浏览器和模拟器运行就会看不到效果,浏览器上报错内容如下:
[.WebGL-0x66240144a900] GL_INVALID_OPERATION: glDrawElements: It is undefined behaviour to have a used but unbound uniform buffer.
effect的内容如下:
CCEffect %{
techniques:
-
name: multiply
passes:
-
vert: legacy/main-functions/general-vs:vert
frag: unlit-fs:frag
blendState:
targets:
-
blend: true
blendSrc: dst_color
blendDst: zero
blendSrcAlpha: one
blendDstAlpha: zero
rasterizerState:
cullMode: none
depthStencilState:
depthTest: false
depthWrite: false
properties: &props
mainTexture: { value: white }
mainColor: { value: [1, 1, 1, 1], editor: { type: color } }
-
-
}%
CCProgram unlit-fs %{
precision highp float;
#include <legacy/output>
#include <legacy/fog-fs>
in vec2 v_uv;
in vec3 v_position;
uniform sampler2D mainTexture;
uniform Constant {
vec4 mainColor;
};
vec4 frag () {
vec4 col = mainColor * texture(mainTexture, v_uv);
CC_APPLY_FOG(col, v_position);
return CCFragOutput(col);
}
}%