texture_set_repeat

Indicates whether to use texture repeats.

Syntax:

GML Code Example

texture_set_repeat(repeat);


Argument Description
repeat Turn texture repeats on (true) or off (false)


Returns: N/A


Description

This function can be used to indicate to GameMaker: Studio 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 texture_set_interpolation_ext.


Example:

GML Code Example

if global.Repeat
    {
    texture_set_repeat(true);
    }
 else
    {
    texture_set_repeat(false);
    }
 

The above code will turn interpolation on or off depending on the value of a global variable.





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