Garry's Mod Wiki

Revision Difference

render.DrawQuad#524633

<function name="DrawQuad" parent="render" type="libraryfunc"> <description> Draws 2 connected triangles. Expects material to be set by <page>render.SetMaterial</page>. <rendercontext hook="false" type="3D"/>⤶ <rendercontext hook="false" type="3D"></rendercontext>⤶ </description> <realm>Client</realm> <args> <arg name="vert1" type="Vector">First vertex.</arg> <arg name="vert2" type="Vector">The second vertex.</arg> <arg name="vert3" type="Vector">The third vertex.</arg> <arg name="vert4" type="Vector">The fourth vertex.</arg> <arg name="color" type="table" default="Color( 255, 255, 255 )">The color of the quad. See <page>Global.Color</page></arg> </args> </function> <example> <description>Draw a red half transparent quad facing upwards 150 units below the 0,0,0 of gm_construct.</description> <code> 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) </code> </example>