render.DrawQuad

From Garry's Mod
Jump to: navigation, search
 render.DrawQuad( )

Contents

Description

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

NOTE

This is a rendering function that requires a 3D rendering context.
This means that it will only work in hooks with a 3D rendering context.

Arguments

Vector vert1

First vertex.

Arguments

Vector vert2

The second vertex.

Arguments

Vector vert3

The third vertex.

Arguments

Vector vert4

The fourth vertex.

Arguments

table color=Color( 255, 255, 255 )

The color of the quad. See Color

Examples

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)


Personal tools
Navigation