draw_set_alpha_test_ref_value

Sets the reference value used by the alpha testing.

Syntax:

draw_set_alpha_test_ref_value(value);


Argument Description
value Sets the reference value for alpha testing from 0 to 255 (default value is 0)


Returns: N/A


Description

This function will set the reference value for the alpha testing (when it has been enabled using the draw_set_alpha_test). This is the "cut-off" threshold at which pixels with alpha will not be drawn.

Basically, if you have this value set to 0 and you have texture interpolation turned on, you can still get visual errors at the edges of overlapping objects. This is because you can have almost completely transparent areas that block things drawn behind them, but if you set this reference value to, for example, 254 (i.e. one below maximum), this guarantees that only 100% opaque pixels are going to be drawn. You can also turn texture interpolation off, which would normally allow you to use the default values with no problems and no need to use this function at all, however a lot depends on the source artwork.

NOTE: This is an advanced drawing feature, so if you are not sure whether you need it or not, or don't know exactly what it does, you are probably better off not using it as it can seriously corrupt how your game is drawn.


Example:

draw_set_alpha_test(true);
draw_set_alpha_test_ref_value(128);

The above code will switch on alpha testing and set the test threshold to 128 (only pixels with an alpha over 0.5 will be drawn).


Back: Drawing
Next: draw_get_alpha_test
© Copyright YoYo Games Ltd. 2018 All Rights Reserved