Get the handle of a given shader sampler.


GML Code Example

shader_get_sampler_index(shader, uniform);

Argument Description
shader The index of the shader to use.
shader The shader sampler to get the handle of (a string).

Returns: Real


Since you cannot change the value of a shader sampler within the shader itself, you have to set it before calling the shader using one of the available uniform set functions. However, to be able to do that you must first call this function to get the "handle" of the shader sampler that you will want to set.

NOTE: Although a shader is made up of two discreet programs (vertex and fragment) this function will not differentiate between the two and will return the handle of the shader sample from either of them.


GML Code Example

shader_sample = shader_get_sampler_index(shader_glass, "s_NoiseSampler");

The above code will get the handle of the shader sample "s_NoiseSampler".

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here