0

出于某种原因,每次我在 CSS 片段着色器中声明自定义变量时,着色器都会停止工作。我不知道为什么会这样,因为我很确定语法是正确的。

这是我的 HTML 代码和我的 CSS:

#holder{
    width:600;
    height:600;
    -webkit-filter :custom(url(v.vs) mix(url(f2.fs) multiply source-over), 20 20);
}
...
...
<div id="holder"></div>

这是我的片段着色器 f2.fs:

void main()
{
    uniform float time;//remove this line and the shader will work!

    css_MixColor = vec4(0.738, 0.821, 0.321, 1.0);

    css_ColorMatrix = mat4(1, 0, 0, 0,
                           0, 1, 0, 0,
                           0, 0, 1, 0,
                           0, 0, 0, 1 );

}

而不是uniform float,我也尝试了floator vec4 test = vec4(1,1,1,1);,但无论我做什么,每次我尝试声明自定义变量时都不会应用着色器。有什么想法吗?

4

1 回答 1

0

我不熟悉 CSS 中的着色器,但在 WebGL 中,您必须uniformmain.

于 2013-04-19T02:28:41.700 回答