5 layout(location= 0) in
vec3 position;
7 uniform mat4 mvpMatrix;
11 gl_Position= mvpMatrix *
vec4(position, 1);
15 #ifdef FRAGMENT_SHADER
16 out
vec4 fragment_color;
18 uniform mat4 invMatrix;
20 uniform sampler2D decal_texture;
21 uniform sampler2D color_texture;
22 uniform sampler2D depth_texture;
27 vec3 color= texelFetch(color_texture, ivec2(gl_FragCoord.xy), 0).rgb;
30 float z= texelFetch(depth_texture, ivec2(gl_FragCoord.xy), 0).r;
31 vec4 position=
vec4(gl_FragCoord.xy, z, 1);
34 vec4 decal_position= invMatrix * position;
36 vec3 decal_color= textureProj(decal_texture, decal_position).rgb;
39 vec3 texcoord= decal_position.xyz / decal_position.w;
41 if(texcoord.x < 0 || texcoord.x > 1)
46 if(texcoord.y < 0 || texcoord.y > 1)
51 if(texcoord.z < 0 || texcoord.z > 1)
56 color= color * decal_color;
57 fragment_color=
vec4(color, 1);
vecteur generique, utilitaire.
vecteur generique 4d, ou 3d homogene, utilitaire.