B
BlueCat6123
Guest
Forgive me if I'm making a rookie mistake, but I can't seem to spot it right off the bat.
I have an alpha shader:
and a controller object (it changes a tile layer's opacity):
the uniform "alpha" doesn't seem to get set, and just leaves the layer always being invisible. Is there something I'm missing? I'm relatively new to shaders so it most likely is just a small mistake.
I have an alpha shader:
Code:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float alpha;
void main()
{
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor.a = gl_FragColor.a * alpha;
}
GML:
//STEP EVENT
//'shader' var is set to above shader
var alphaShader = shader_get_uniform(shader,"alpha");
shader_set_uniform_f(alphaShader,alpha);
layer_shader(tileLayer,shader);