HUD Img Glitching.

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:


	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 )

The texture loads tryed to make it transparent not transparent, still same thing

Hares an example what I get.

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:


"LightmappedGeneric"
{
	"$basetexture" "go4p/g4"
	"$translucent" 1
}


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.

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! :slight_smile: