Quick question: How do I color VTF/VMTs with surface.SetTexture?
2 replies, posted
So I'm trying to use surface.DrawTexturedRectRotated(x,y,wide,tall,degrees) and it's working, but I'm curious as to change the color without editing the actual texture. I know there is a way to do it, as the color tool in sandbox does just that (I would assume).
Keep in mind this is for use in vgui, not in game rendering.
[lua]
if SERVER then
function testRotate( player, command, arguments )
umsg.Start("rotate", player)
umsg.End()
end
concommand.Add("crescent", testRotate)
end
if CLIENT then
usermessage.Hook("rotate", function()
hook.Add("HUDPaint", "bla", function()
tx = surface.GetTextureID("zukofiddy/white")
surface.SetDrawColor(255,255,255,1)
surface.SetTexture(tx)
surface.DrawTexturedRectRotated(ScrW()/2 - 100,ScrH()/2 -100,200,200, 0)
end )
end )
end
[/lua]
The texture is a pure white crescent, just curious how to change the color for it. Here is the vmt:
[lua]
"UnlitGeneric"
{
"$basetexture" "zukofiddy/white"
"$translucent" 1
}
[/lua]
EDIT:
-----------
Found this and tacked in to the vmt:
[lua]
"$vertexcolor" "1"
"$vertexalpha" "1"
[/lua]
I can color now! Yay! Regardless, if you have any tips for problems I might run into / other things I should include in the VMT, any help is very much apprciated.
Try adding "$vertexcolor" "1"
[QUOTE=Robotboy655;45504692]Try adding "$vertexcolor" "1"[/QUOTE]
Thanks again man!
Sorry, you need to Log In to post a reply to this thread.