Garry's Mod Wiki

surface.SetDrawColor

void surface.SetDrawColor( number r, number g, number b, number a = 255 )

Description

Set the color of any future shapes to be drawn, can be set by either using r, g, b, a as separate values or by a Color. Using a color structure is not recommended to be created procedurally.

Arguments

1 number r
The red value of color, or a Color.
2 number g
The green value of color. Unused if a Color was given.
3 number b
The blue value of color. Unused if a Color was given.
4 number a = 255
The alpha value of color. Unused if a Color was given.

Example

Draws a 512x512 textured rectangle with the wireframe material

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

Page Links


Special Pages


Wikis

?

Render Time: 28ms

Session 0
DB GetPage 4
Generate Html 2
SaveChanges 12
Render Body 0
Render Sidebar 8