Skip to content

Instantly share code, notes, and snippets.

@elektrowolle
Created October 15, 2015 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elektrowolle/71d78d2c3cf8eeae4d6f to your computer and use it in GitHub Desktop.
Save elektrowolle/71d78d2c3cf8eeae4d6f to your computer and use it in GitHub Desktop.
#version 150
uniform sampler2DRect tex0;
uniform float blurAmnt = 1.0;
uniform float fvert = 1.0;
out vec4 outputColor;
in vec2 texCoordVarying;
void main()
{
bool bvert = fvert > 0.0;
vec4 color;
float max = 20;
color = vec4(0,0,0,0);
for (float i = 1.0; i < max; i+= 1.0) {
color += i * texture(tex0, texCoordVarying + vec2(blurAmnt * (bvert ? -(max - i) : 0.0), blurAmnt * (!bvert ? -(max - i) : 0.0)));
}
//
// color += max * texture(tex0, texCoordVarying + vec2(bvert ? blurAmnt : 0, !bvert ? blurAmnt : 0));
for (float i = max - 1.0; i > 0; i-= 1.0) {
color += i * texture(tex0, texCoordVarying + vec2(blurAmnt * (bvert ? (max - i) : 0.0), blurAmnt * (!bvert ? (max - i) : 0.0)));
}
color /= max;
//
// color += max * texture(tex0, texCoordVarying + vec2(bvert ? blurAmnt : 0, !bvert ? blurAmnt : 0));
// color += texture(tex0, texCoordVarying + vec2(blurAmnt, blurAmnt));
outputColor = color;
}
#version 150
// these are for the programmable pipeline system
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;
in vec4 position;
in vec2 texcoord;
in vec4 normal;
in vec4 color;
out vec2 texCoordVarying;
void main()
{
#ifdef INTEL_CARD
color = vec4(1.0); // for intel HD cards
normal = vec4(1.0); // for intel HD cards
#endif
texCoordVarying = texcoord;
gl_Position = modelViewProjectionMatrix * position;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment