So I’m drawing this quad, but it always turns out white no matter what. Code:
[lua]
local matWhite = Material( “color/white” )
// --------------------------------------------------------------------------------
// Draw3D2DLine - Renders a line in 3D space
// --------------------------------------------------------------------------------
function render.Draw3D2DLine( startpos, endpos, normal, colour, thickness )
// Calculate coords
local dir = (endpos-startpos):Normalize()
local dir_right = dir:Angle():Right()
local dir_left = dir_right*-1
local c1 = startpos + (dir_leftthickness0.5)
local c2 = startpos + (dir_rightthickness0.5)
local c3 = endpos + (dir_leftthickness0.5)
local c4 = endpos + (dir_rightthickness0.5)
// Render
render.SetMaterial( matWhite )
render.SuppressEngineLighting( true )
render.SetColorModulation( 0, 1, 0 )
render.DrawQuad( c1, c3, c4, c2 )
render.SetColorModulation( 1, 1, 1 )
render.SuppressEngineLighting( false )
end[/lua]
color/white.vmt:
"UnlitGeneric"
{
"$basetexture" "color/white"
"$vertexalpha" 1
}
The line itself draws perfectly in every way apart from the colour.
Now you may be thinking “of course it’s white, you chose the color/white material dumbass” but surely, the color modulation stuff should allow me to manipulate the colour exactly?
[editline]06:05PM[/editline]
Just realised I have no idea why I passed in a parameter called “normal” but oh well.