Garry's Mod Wiki

render.DrawQuad

  render.DrawQuad( Vector vert1, Vector vert2, Vector vert3, Vector vert4, table color = Color( 255, 255, 255 ) )

Description

Draws 2 connected triangles. Expects material to be set by render.SetMaterial.

This is a rendering function that requires a 3d rendering context.

This means that it will only work in 3d Rendering Hooks.

Arguments

1 Vector vert1
First vertex.
2 Vector vert2
The second vertex.
3 Vector vert3
The third vertex.
4 Vector vert4
The fourth vertex.
5 table color = Color( 255, 255, 255 )
The color of the quad. See Color

Example

Draw a red half transparent quad facing upwards 150 units below the 0,0,0 of gm_construct.

local ourMat = Material( "vgui/white" ) -- Calling Material() every frame is quite expensive hook.Add( "PostDrawTranslucentRenderables", "DrawQuad_Example", function() render.SetMaterial( ourMat ) -- If you use Material, cache it! render.DrawQuad( Vector( 0, 0, -150 ), Vector( 0, 100, -150 ),Vector( 100, 100, -150 ), Vector( 100, 0, -150 ), Color( 255, 0, 0, 128 ) ) end)