H

#### Humphrey M

##### Guest

I keep getting an error when I compile my game to HTML5. It says:

The purpose of the shader is so when the game is paused, it draws a blurred screenshot of the game behind the pause screen.

This is my code (this actually isn't my code I found it on the forums, I've got no idea how to code for shaders lol)

(fragment code part) shader name: shade_blur

varying vec2 v_vTexcoord;

varying vec4 v_vColour;

uniform float sigma;

uniform float blurSize;

float pii = 3.14159265;

float numBlurPixelsPerSide = 8.0;

vec2 blurMultiplyVec = vec2(1.0, 0.0);

void main()

{

vec3 incrementalGaussian;

incrementalGaussian.x = 1.0 / (sqrt(2.0 * pii) * sigma);

incrementalGaussian.y = exp(-0.5 / (sigma * sigma));

incrementalGaussian.z = incrementalGaussian.y * incrementalGaussian.y;

vec4 avgValue = vec4(0.0, 0.0, 0.0, 0.0);

float coefficientSum = 0.0;

avgValue += texture2D(gm_BaseTexture, v_vTexcoord.xy) * incrementalGaussian.x;

coefficientSum += incrementalGaussian.x;

incrementalGaussian.xy *= incrementalGaussian.yz;

for (float i = 1.0; i <= numBlurPixelsPerSide; i++)

{

avgValue += texture2D(gm_BaseTexture, v_vTexcoord.xy - i * blurSize * blurMultiplyVec) * incrementalGaussian.x;

avgValue += texture2D(gm_BaseTexture, v_vTexcoord.xy + i * blurSize * blurMultiplyVec) * incrementalGaussian.x;

coefficientSum += 2.0 * incrementalGaussian.x;

incrementalGaussian.xy *= incrementalGaussian.yz;

}

gl_FragColor = avgValue / coefficientSum;

}

Any help would be really appreciated, I've published my game but there's that annoying pop-up whenever you enter the game and the shader doesn't work properly (it works [shows background behind pause menu] but the blur does not work). I have made sure Web Gl is activated. Thanks!!