Last active
August 10, 2020 19:10
-
-
Save pJotoro/cfd143bc0c36a4508b456a5ba3d4ac8d to your computer and use it in GitHub Desktop.
Gamemaker shader confusion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
draw_self(); | |
flash(0.05); // This is unrelated. | |
flash_red(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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