T
Tafauxpar
Guest
Hey everyone,
I am developing a game with only two colors that change from level to level.
I'm using a shader to do so which works fine even though it is pretty simple.
However, on certain computers, the shader does not work and I have no idea why.
I was wondering if you could help me with it.
The shader (GLSL ES) is this:
--------------------------------------------------------------------------
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec3 rep1;
uniform vec3 rep2;
uniform vec3 new1;
uniform vec3 new2;
void main()
{
vec4 rgba = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec3 rgb = rgba.rgb;
//Check if it needs to be replaced
if (rgb == rep1) {
rgb = new1;
}
if (rgb == rep2) {
rgb = new2;
}
gl_FragColor = vec4(rgb, rgba.a);
}
------------------------------------------------------------------------------
And the use is in a called script from a controller which reads:
-----------------------------------------------------------------------------
outlineColor = initiate_border_color(0);
boxColor = initiate_border_color(1);
shader_set(shader_color);
shader_set_uniform_f(shader_get_uniform(shader_color, "rep1"), 64.0/255.0,64.0/255.0,1.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "new1"), colour_get_red(outlineColor)/255.0, colour_get_green(outlineColor)/255.0, colour_get_blue(outlineColor)/255.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "rep2"), 128.0/255.0,128/255.0,1.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "new2"), colour_get_red(boxColor)/255.0, colour_get_green(boxColor)/255.0, colour_get_blue(boxColor)/255.0)
--------------------------------------------------------------------------
So basically, it takes two colors (64,64,255 and 128,128,255) which are both tints of blue and transforms them into different colors so all my sprites are only these two colors.
If you could help me with my problem, I'll really appreciate it.
Thank you,
I am developing a game with only two colors that change from level to level.
I'm using a shader to do so which works fine even though it is pretty simple.
However, on certain computers, the shader does not work and I have no idea why.
I was wondering if you could help me with it.
The shader (GLSL ES) is this:
--------------------------------------------------------------------------
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec3 rep1;
uniform vec3 rep2;
uniform vec3 new1;
uniform vec3 new2;
void main()
{
vec4 rgba = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec3 rgb = rgba.rgb;
//Check if it needs to be replaced
if (rgb == rep1) {
rgb = new1;
}
if (rgb == rep2) {
rgb = new2;
}
gl_FragColor = vec4(rgb, rgba.a);
}
------------------------------------------------------------------------------
And the use is in a called script from a controller which reads:
-----------------------------------------------------------------------------
outlineColor = initiate_border_color(0);
boxColor = initiate_border_color(1);
shader_set(shader_color);
shader_set_uniform_f(shader_get_uniform(shader_color, "rep1"), 64.0/255.0,64.0/255.0,1.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "new1"), colour_get_red(outlineColor)/255.0, colour_get_green(outlineColor)/255.0, colour_get_blue(outlineColor)/255.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "rep2"), 128.0/255.0,128/255.0,1.0)
shader_set_uniform_f(shader_get_uniform(shader_color, "new2"), colour_get_red(boxColor)/255.0, colour_get_green(boxColor)/255.0, colour_get_blue(boxColor)/255.0)
--------------------------------------------------------------------------
So basically, it takes two colors (64,64,255 and 128,128,255) which are both tints of blue and transforms them into different colors so all my sprites are only these two colors.
If you could help me with my problem, I'll really appreciate it.
Thank you,