i have a basic question about glsl.
now i have a vert like this
varying vec2 texCoordVarying;
void main()
{
vec2 texcoord = gl_MultiTexCoord0.xy;
texCoordVarying = vec2(texcoord.x , texcoord.y);
// send the vertices to the fragment shader
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
then i have two different frag
one is like this
uniform sampler2DRect Texture;
uniform vec4 Color;
varying vec2 texCoordVarying;
void main(void)
{
vec2 st = texCoordVarying.st;vec4 tex = texture2DRect(Texture, st); //gl_FragColor = vec4(tex.x,tex.y,tex.z,1); if(tex.a > 0.0 && (tex.r > 0.0 || tex.g > 0.0 || tex.b > 0.0)) { gl_FragColor = Color; } else { gl_FragColor = vec4(0.0); }
}
two like this
uniform sampler2DRect Texture;
uniform vec4 Color;
varying vec2 texCoordVarying;
void main(void)
{
vec2 st = gl_TexCoord[0].st;vec4 tex = texture2DRect(Texture, st); //gl_FragColor = vec4(tex.x,tex.y,tex.z,1); if(tex.a > 0.0 && (tex.r > 0.0 || tex.g > 0.0 || tex.b > 0.0)) { gl_FragColor = Color; } else { gl_FragColor = vec4(0.0); }
}
One is working ,two can’t work.
Is the opengl version problem?
But I can’t understand it.