Hello, short storry, trying to create hud in gmod, so far so good, stuck on image, tryed to add an image on hud.
My lua code:
[CODE] local ourMat = Material( "go4p/g4" ) -- Calling Material() every frame is quire expensive
hook.Add( "HUDPaint", "g4", function()
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( ourMat ) -- If you use Material, cache it!
surface.DrawTexturedRect( 0, 0, 100, 100 )
end )[/CODE]
The texture loads tryed to make it transparent not transparent, still same thing
Hares an example what I get.
[IMG]http://i.gyazo.com/f96262554576f7b55799c8f0f9b9419c.png[/IMG] [IMG]http://i.gyazo.com/1a6bfc2e48f3237583a60fec1f338d7a.png[/IMG] [IMG]http://i.gyazo.com/050cd563a8acac65995d7252bf734a81.png[/IMG]
Avery time I move the image flickers differently. I dont know maybe its vmt problem. the files are vtf and vmt btw.
Hares my vmt:
[CODE]"LightmappedGeneric"
{
"$basetexture" "go4p/g4"
"$translucent" 1
}
[/CODE]
Default one. Dont have alot of experiance on Lua coding, so I would like to get help, Im stuck.
You must use UnlitGeneric shader for HUD elements.
[QUOTE=lowlyexc;47473467]Hello, short storry, trying to create hud in gmod, so far so good, stuck on image, tryed to add an image on hud.
My lua code:
[CODE] local ourMat = Material( "go4p/g4" ) -- Calling Material() every frame is quire expensive
hook.Add( "HUDPaint", "g4", function()
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( ourMat ) -- If you use Material, cache it!
surface.DrawTexturedRect( 0, 0, 100, 100 )
end )[/CODE]
The texture loads tryed to make it transparent not transparent, still same thing
Hares an example what I get.
[IMG]http://i.gyazo.com/f96262554576f7b55799c8f0f9b9419c.png[/IMG] [IMG]http://i.gyazo.com/1a6bfc2e48f3237583a60fec1f338d7a.png[/IMG] [IMG]http://i.gyazo.com/050cd563a8acac65995d7252bf734a81.png[/IMG]
Avery time I move the image flickers differently. I dont know maybe its vmt problem. the files are vtf and vmt btw.
Hares my vmt:
[CODE]"LightmappedGeneric"
{
"$basetexture" "go4p/g4"
"$translucent" 1
}
[/CODE]
Default one. Dont have alot of experiance on Lua coding, so I would like to get help, Im stuck.[/QUOTE]
Your texture should not inherit from LightmappedGeneric. HUD Elements really don't like being lightmapped.
Try using UnlitGeneric.
Edited:
oof, killer ninja
Thank you both, I kinda thought that tthere is something wrong witht he light shadows thingy. But I didint think that u can change this, well Ill know now, thanks! :)
Sorry, you need to Log In to post a reply to this thread.