Skip to content

Instantly share code, notes, and snippets.

@pJotoro
Last active August 10, 2020 19:10
Show Gist options
  • Save pJotoro/cfd143bc0c36a4508b456a5ba3d4ac8d to your computer and use it in GitHub Desktop.
Save pJotoro/cfd143bc0c36a4508b456a5ba3d4ac8d to your computer and use it in GitHub Desktop.
Gamemaker shader confusion
if red > 0
{
shader_set(sh_red);
shade_alpha = shader_get_uniform(sh_red, "alpha");
shader_set_uniform_f(shade_alpha, 0);
draw_self();
shader_reset();
}
draw_self();
flash(0.05); // This is unrelated.
flash_red();
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float alpha;
void main()
{
vec4 color = texture2D(gm_BaseTexture, v_vTexcoord);
if (color.a != 0.0)
{
gl_FragColor = vec4(1, 0, 0, alpha); // This tutorial that I watched showed that setting the first number to 1 made the object completely red, though for whatever reason it has not affected the look of the player at all.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment