C
Charyb
Guest
Using GMS v1.99.505
On Android my shader works perfectly fine until I use the "Home" button or the "Recent Apps" button.
Afterwards when I return to my app, it's as if the shader has turned off completely, not sure why.
Here's my shader fragment (shd_overlay):
And the Draw GUI Event of my shader object:
And the logs from the console (I marked where I went home / resumed the app):
On Android my shader works perfectly fine until I use the "Home" button or the "Recent Apps" button.
Afterwards when I return to my app, it's as if the shader has turned off completely, not sure why.
Here's my shader fragment (shd_overlay):
Code:
//
// Overlay Shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform sampler2D texStage;
void main()
{
vec4 inColor = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec4 outColor = vec4(0.0, 0.0, 0.0, inColor.a);
vec4 overlay = texture2D(texStage, v_vTexcoord);
if (inColor.r > 0.5)
{
outColor.r = (1.0 - (1.0 - 2.0 * (inColor.r - 0.5)) * (1.0 - overlay.r));
}
else
{
outColor.r = ((2.0 * inColor.r) * overlay.r);
}
if (inColor.g > 0.5)
{
outColor.g = (1.0 - (1.0 - 2.0 * (inColor.g - 0.5)) * (1.0 - overlay.g));
}
else
{
outColor.g = ((2.0 * inColor.g) * overlay.g);
}
if (inColor.b > 0.5)
{
outColor.b = (1.0 - (1.0 - 2.0 * (inColor.b - 0.5)) * (1.0 - overlay.b));
}
else
{
outColor.b = ((2.0 * inColor.b) * overlay.b);
}
gl_FragColor = mix(outColor, inColor,1.0 - overlay.a);
}
Code:
if(shader_is_compiled(shader)){
shader_set(shader);
texture_set_stage(stage, surface_get_texture(surface_bg));
//if(surface_get_width(application_surface) != idealWidth)
//surface_resize(application_surface, idealWidth, idealHeight);
draw_surface(application_surface, 0, 0);
shader_reset();
}