Garry's Mod Wiki


surface.DrawTexturedRect( number x, number y, number width, number height )


Draw a textured rectangle with the given position and dimensions on the screen, using the current active texture set with surface.SetMaterial. It is also affected by surface.SetDrawColor.

See also render.SetMaterial and render.DrawScreenQuadEx.<br> See also surface.DrawTexturedRectUV.

<rendercontext hook="false" type="2D"/>


1 number x
The X integer co-ordinate.
2 number y
The Y integer co-ordinate.
3 number width
The integer width of the rectangle.
4 number height
The integer height of the rectangle.


Draws a 512x512 textured rectangle with the wireframe texture.

local ourMat = Material( "models/wireframe" ) -- Calling Material() every frame is quite expensive hook.Add( "HUDPaint", "example_hook", function() surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( ourMat ) -- If you use Material, cache it! surface.DrawTexturedRect( 0, 0, 512, 512 ) end )

Page Links

Special Pages



Render Time: 52ms

Session 0
DB GetPage 3
Generate Html 16
SaveChanges 23
Render Body 0
Render Sidebar 7