I just stated working with shaders myself
I did a basic shader and then copied one from the internet to kinda play around with it and check it out.
But I just get nothing and I’m not sure how to debug shaders
Vertex shader
void main()
{
gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
}
Fragment shader
#version 120
uniform sampler2D u_texture;
// Currently not used
uniform float time = 1.0;
// Swirl effect parameters
uniform float radius = 80.0;
uniform float angle = 2.8;
uniform vec2 center = vec2(50.0, 50.0);
vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
vec2 texSize = vec2(512, 512);
vec2 tc = uv * texSize;
tc -= center;
float dist = length(tc);
if (dist < radius)
{
float percent = (radius - dist) / radius;
float theta = percent * percent * angle * 8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec3 color = texture2D(tex, tc / texSize).rgb;
return vec4(color, 1.0);
}
void main (void)
{
vec2 uv = gl_TexCoord[0].st;
gl_FragColor = PostFX(u_texture, uv, time);
}
its supposed to be like a swirl effect but I’m getting nothing.
It might also be that the vertex shader is wrong, since its very different from the default vertex shader