1 // Invert x & y 2 static const char *myShaderY = 3 "#extension GL_ARB_texture_rectangle: enable\n" 4 "uniform sampler2DRect myTexture;\n" 5 "uniform int kernelSize;\n" 6 "uniform int normalization;\n" 7 8 "void main(void) {\n" 9 " int nx = (int)gl_TexCoord[0].x;\n" 10 " int ny = (int)gl_TexCoord[0].y;\n" 11 " float t = 0;\n" 12 " float mul;\n" 13 " int x,y;\n" 14 " for(y=-kernelSize;y<=kernelSize;y++)\n" 15 " {\n" 16 " for(x=-kernelSize;x<=kernelSize;x++)\n" 17 " {\n" 18 " if(0==x && 0==y){ mul=4;}\n" 19 " else if(0==x) {mul=-1;}\n" 20 " else if(0==y) {mul=-1;}\n" 21 " else {mul=0;}\n" 22 " t += mul*texture2DRect(myTexture, vec2(nx+x, ny+y)).r;\n" 23 " }\n" 24 " }\n" 25 " t=t/normalization;\n" 26 " t=t+texture2DRect(myTexture, vec2(nx, ny)).r;\n" 27 " gl_FragColor = vec4(t, t, t, 1.0);\n" 28 "}\n"; 29 30