G.Material

From GMod Wiki

Jump to: navigation, search
Function
Syntax Material( String filepath, String tags )
Where is this used?
Description:
Opens and reads the given filepath and converts into table, to use with material settings such as render.SetMaterial must be a usable format, give filename without an extension to use
Returns: IMaterial , Number
Part of Library: Global Functions
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.Material]G.Material [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis will set the render texture to a texture in a file.
Used onNewerClient.png
Code
local material = Material ("textures/theimage")
render.SetMaterial( material )
OutputN/A


Tags and materials using PNGs are currently available only in Garry's Mod Beta 13


DescriptionDraws a 16 x 16 arrow PNG file without culling.
Used onNewerClient.png
Code
local material = Material ("widgets/arrow.png", "nocull")
local function paintPNG()
 surface.DrawTexturedRect( material, 0, 0, 16, 16 )
end
hook.Add( "HUDPaint", "paintPNG", paintPNG )
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox