This function can be used to indicate to GameMaker Studio 2 whether textures should repeat (true) or not (false) when used for models and primitives. Normally texture widths and heights lie in the range 0 - 1, but if you specify a value larger than 1 by default the rest is not drawn (the entire texture will be drawn with an "empty" section corresponding to the percentage over 1 that is used. So a value of 2 for a texture width or height would draw the texture in half the space and leave the other half empty). However, by using this function to set repeat to true the texture is repeated automatically over all models and primitives.
NOTE: Sprites and backgrounds are always drawn without repeating, so once you draw a sprite or background this value is reset to false. This default behaviour will not affect texture stage settings (ie: calling the function will, but the internal setting to false will not).NOTE: This setting will over-ride any texture stage repeats set for shaders when using the function gpu_set_texrepeat_ext.
gpu_set_texrepeat(enable);
参数 描述 enable Enable or disable texture filtering (true / false)
N/A(无返回值)
if gpu_get_texrepeat()
{
gpu_set_texrepeat(false);
}
else
{
gpu_set_texrepeat(true);
}
The above code checks to see if texture repeating is on or off and switches it accordingly.