OpenGL Fragment Shader
以下のようにすると、フラグメントシェーダでガウシアンのぼかしができます。
uniform sampler2D sampler0; uniform float offset; void main() { gl_FragColor = 0.075 * texture2D(sampler0, gl_TexCoord[0].st + vec2(-offset,-offset)) + 0.125 * texture2D(sampler0, gl_TexCoord[0].st + vec2(0.0,-offset)) + 0.075 * texture2D(sampler0, gl_TexCoord[0].st + vec2(offset,-offset)) + 0.125 * texture2D(sampler0, gl_TexCoord[0].st + vec2(-offset,0.0)) + 0.200 * texture2D(sampler0, gl_TexCoord[0].st + vec2(0.0,0.0)) + 0.125 * texture2D(sampler0, gl_TexCoord[0].st + vec2(offset,0.0)) + 0.075 * texture2D(sampler0, gl_TexCoord[0].st + vec2(-offset,offset)) + 0.125 * texture2D(sampler0, gl_TexCoord[0].st + vec2(0.0,offset)) + 0.075 * texture2D(sampler0, gl_TexCoord[0].st + vec2(offset,offset)); }