2006.12.02, 10:26 AM
Hey everyone.
I have very little knowledge in how to code shaders but I downloaded some glsl shader examples. But when I imported the .vert/.frag files and run the engine, I either crash the engine or else the texture with the shader on it is totally transparent(Or so it seems).
Here is the shader code.
What can I do to fix this?
I have very little knowledge in how to code shaders but I downloaded some glsl shader examples. But when I imported the .vert/.frag files and run the engine, I either crash the engine or else the texture with the shader on it is totally transparent(Or so it seems).
Here is the shader code.
Code:
uniform sampler2D tex0;
void main(void)
{
vec4 blurSample = 0.0;
vec4 tmpPix;
vec4 offPix;
vec2 uv = gl_TexCoord[0].st;
for(int i=-4;i<5;i++)
{
tmpPix = texture2D(tex0,uv + vec2( i*0.005,0 ));
offPix = -0.3+tmpPix;
offPix = offPix * 15;
if( (offPix.r+offPix.g+offPix.b)>0 )
{
blurSample = blurSample + offPix;
}
}
for(int i=-4;i<5;i++)
{
tmpPix = texture2D(tex0,uv + vec2( 0,i*0.005 ));
offPix = -0.3+tmpPix;
offPix = offPix * 15;
if( (offPix.r+offPix.g+offPix.b)>0 )
{
blurSample += offPix;
}
}
blurSample = blurSample / 64;
gl_FragColor = blurSample*1.2;
}What can I do to fix this?