vignette shader dons't work

here is my code I realy got stucked for a while cous I can’t make this one I’m a beginer with the shaders could you guys help me?

this is my fragmen shader:

#version 330

uniform vec4 color;

void main(void)
{
//xsize of the block 100.0 y size of the block 100.0
//vec2 position = vec2 (gl_FragCoord.x/100.0,gl_FragCoord.y/100.0)-vec2(0.5);

vec2 position = (gl_FragCoord.xy  * 0.5f);

float len = length (position);     
gl_FragColor = vec4(color.r * (1.0 - len),color.g * (1.0 - len),color.b * (1.0 - len),color.a);

}
I want to load it on each block in the game but I can’t make it

try [icode]0.5[/icode] instead of [icode]0.5f[/icode].

what’s a block ?

60.0f 30.0f rectangle thx for the asnwer I fixed that one but it’s still goes on the full srceen not on the center of the blocks

gl_FragCoord is alway the absolute coordinate of the pixel in the frame buffer, hence on the full screen. You need to pass in the “texture coordinates” from your vertex shader. See http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/glsl-core-tutorial-texture-coordinates/ for more explanation. It’s the same principle, even without applying a texture image.

thx for the answer I will try to figure it out

ok I got no more idea I made this code and it’s still a vignetta effect but smaller what I did wrong?

vertexshader

#version 330
layout (location = 0) in vec3 coord3f;

uniform mat4 transformation;
out vec4 pos;
void main(void)
{
pos = transformation * vec4(coord3f.x, coord3f.y, coord3f.z, 1.0);
gl_Position = transformation * vec4(coord3f.x, coord3f.y, coord3f.z, 1.0);

}

fragshader
#version 330

uniform mat4 transformation;
uniform vec4 color;
uniform vec4 position;
in vec4 pos;
void main(void)
{

float len = length (pos.xy);   

gl_FragColor = vec4(color.rgb * (1.0 - len),color.a);
//gl_FragColor = color;

}

maybe watch this video… it’s explaining a better way to implement this effect.

thx for al the answers I found a solution for my problem.
thx for the help you it’s a realy nice comunity