Garry's Mod Wiki


surface.SetMaterial( IMaterial material )


Sets the material to be used in all upcoming draw operations using the surface library.

Not to be confused with render.SetMaterial.

See also surface.SetTexture.

If you need to unset the texture, use the draw.NoTexture convenience function.

Material function calls are expensive to be done inside this function or inside rendering context, you should be caching the results of Material calls
When using render.PushRenderTarget or render.SetRenderTarget, material should have the $ignorez flag set to make it visible. If the material is not used in 3D rendering, it is probably safe to add it with this code:

material:SetInt( "$flags", bit.bor( material:GetInt( "$flags" ), 32768 ) )


1 IMaterial material
The material to be used.

Page Links

Special Pages



Render Time: 214ms

DB GetPage 61
Generate Html 12
SaveChanges (1) 119
Render Body 0
Render Sidebar 20