Garry's Mod Wiki


Material:SetMaterial( string matname )


Sets the material used by the panel.

If the material is not showing up as the correct size, try setting the Material panel's AutoSize variable to false


1 string matname
The file path of the material to set (relative to "garrysmod/materials/").


Creates a Material panel and sets the material to a screen space effect.

-- Black background panel BGPanel = vgui.Create("DPanel") BGPanel:SetSize(200, 200) BGPanel:Center() BGPanel:SetBackgroundColor(Color(0, 0, 0, 255)) local mat = vgui.Create("Material", BGPanel) mat:SetPos(5, 5) mat:SetSize(190, 190) -- It's not really good to use a models material for VGUI drawing -- But it looks good enough for a quick demo mat:SetMaterial("models/screenspace") -- Stretch to fit mat.AutoSize = false

Page Links

Special Pages



Render Time: 31ms

DB GetPage 4
Generate Html 2
SaveChanges (1) 9
Render Body 0
Render Sidebar 13