Garry's Mod Wiki

IMaterial:SetTexture

  IMaterial:SetTexture( string materialTexture, ITexture texture )

Description

Sets the specified material texture to the specified texture, does nothing on a type mismatch.

Arguments

1 string materialTexture
The name of the keyvalue on the material to store the texture on.
2 ITexture texture
The new texture. This can also be a string, the name of the new texture.

Example

Example usage of this function.

local blur_mat = Material( "pp/bokehblur" ) blur_mat:SetTexture( "$basetexture", render.GetScreenEffectTexture() )

Example

Equivalent of Example 1, demonstrating the use of a texture's name.

local blur_mat = Material( "pp/bokehblur" ) blur_mat:SetTexture( "$basetexture", "_rt_fullframefb" )