texture_set_stage

Indicates which texture "slot" to add a texture to when working with shaders.

Syntax:

texture_set_stage(stage, tex);


Argument Description
stage The texture "slot" to use.
tex The texture to use.


Returns: N/A


Description

This function will set the given stage "slot" a texture to be used. The number of stage "slots" available will depend on the platform you are compiling to, with a maximum of 8 being available for Windows, Mac and Linux, but on lower end Android devices (for example) this number can be as low as 2. It is also worth noting that the first stage "slot" is always used automatically by GameMaker: Studio.

NOTE: This function will do nothing outside of the context of a running shader! See Shaders for more information.


Example:

glassshader_bgsampler = shader_get_sampler_index(GlassShader, "s_BackgroundSampler")
spr = sprite_get_texture(sprite_index, 0);
shader_set(GlassShader);
texture_set_stage(glassshader_bgsampler, spr);
shader_reset();

The above code will get the handle for the sampler within the shader indexed as "GlassShader" and then set that shader constant to the given sprite texture.


Back: Drawing
Next: draw_texture_flush
© Copyright YoYo Games Ltd. 2015 All Rights Reserved