|
想实现一个圆环状的贴图。在某一范围内显示某种颜色。以下是片元着色器的代码。请教各位大侠,哪里出错了?
uniform sampler2D sampler0;
uniform sampler2D sampler1;
uniform float factor;
uniform float zfloor;
uniform vec4 suncolor;
void main(void)
{
{
vec4 color1=texture2D(sampler0,gl_TexCoord[0].st);
vec4 color2=texture2D(sampler1,gl_TexCoord[1].st);
color1=factor*color1;
color2=(1-factor)*color2;
vec4 color=color1+color2;
vec2 st1(gl_TexCoord[0].s,gl_TexCoord[0].t);
vec2 org1(0.5,0.5);
float stdist=distance(st1,org1);
if(stdist=<0.5)
{
if(stdist>=zfloor)
gl_FragColor=vec4(1,0,0,1);
else
gl_FragColor=color1;
}
}
} |
|