Finbox Entertainment
Member
Hello, I have the following code on my main object which draws the sprites.
####################### DRAW EVENT OF MAIN OBJECT #########################
shader_set(shd_colorchange);
shader_set_uniform_f(shader_get_uniform(shd_colorchange, "u_v4_wantedColor"), 1.0, 0.0, 1.0);
draw_sprite_ext(spr_enemy, 0, x, y, 1, 1, 0, c_white, 1)
shader_reset();
##########################################################################
And this is my shader code.
########################## FRAGMENT SHADER CODE ###########################
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec4 u_v4_wantedColor;
void main()
{
vec4 base_col = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec4 new_col;
new_col.r = u_v4_wantedColor.r;
new_col.g = u_v4_wantedColor.g;
new_col.b = u_v4_wantedColor.b;
new_col.a = 1.0;
gl_FragColor = new_col;
}
##########################################################################
On Windows, the code works perfectly fine, it draws the sprite with a purple color.
When I run the game on Android, the uniform rgb values seem to become 0,0,0 because the output color is black. So the problem seems that on Android devices something happens with the uniform before it is given to the shader.
When I write the rgb values directly into the shader code without using a uniform, it also works on Android so it can not be my Android device's GPU.
Graphic settings in the attachment.
Please help!
####################### DRAW EVENT OF MAIN OBJECT #########################
shader_set(shd_colorchange);
shader_set_uniform_f(shader_get_uniform(shd_colorchange, "u_v4_wantedColor"), 1.0, 0.0, 1.0);
draw_sprite_ext(spr_enemy, 0, x, y, 1, 1, 0, c_white, 1)
shader_reset();
##########################################################################
And this is my shader code.
########################## FRAGMENT SHADER CODE ###########################
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec4 u_v4_wantedColor;
void main()
{
vec4 base_col = v_vColour * texture2D(gm_BaseTexture, v_vTexcoord);
vec4 new_col;
new_col.r = u_v4_wantedColor.r;
new_col.g = u_v4_wantedColor.g;
new_col.b = u_v4_wantedColor.b;
new_col.a = 1.0;
gl_FragColor = new_col;
}
##########################################################################
On Windows, the code works perfectly fine, it draws the sprite with a purple color.
When I run the game on Android, the uniform rgb values seem to become 0,0,0 because the output color is black. So the problem seems that on Android devices something happens with the uniform before it is given to the shader.
When I write the rgb values directly into the shader code without using a uniform, it also works on Android so it can not be my Android device's GPU.
Graphic settings in the attachment.
Please help!
Attachments
-
41.5 KB Views: 2