I try to implement a fullscreen GLSL ES shader in my GameMaker Studio project. However, I get different results on almost every device I test. I made a small test project to showcase the problem.
Vertex Shader:
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}
Fragment shader:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
if(v_vTexcoord.x > 0.5)
{
gl_FragColor = vec4(0,1,0,1);
}
else if(v_vTexcoord.y > 0.5)
{
gl_FragColor = vec4(0,0,1,1);
}
else
{
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}
}
And these are the results:
https://dl.dropboxusercontent.com/u/14513191/shader_problem.jpg
This is how it should look on PC / 1920x1080
Samsung Galaxy Alpha / 1280x720
PadFone Infinity / 1920x1080
Has anyone an idea what's going on here?