HUD texture black?

[lua]local ExampleTexture = surface.GetTextureID( “bacon” );

function PaintBoxToScreen()
local BoxSize = 60;
local Offset = BoxSize / 2;

surface.SetDrawColor( 255, 255, 255, 255 );
surface.SetTexture( ExampleTexture );
surface.DrawTexturedRect( cx, cy, BoxSize, BoxSize );

hook.Add( “HUDPaint”, “PaintBoxToScreen”, PaintBoxToScreen );[/lua]

This is what I’m using, however the image shows up perfectly fine (flickers on with the correct textures and then goes back to black). That’s mainly the issue. I tried the example on the wiki with the brick texture and it does exactly the same.


The black flashing isn’t a problem with your code, it’s the texture you’re using’s .vmt file. If you open up your texture’s .vmt, you’ll see that it’s shader is most likely set to LightmappedGeneric. Change it to UnlitGeneric.

It still seems to be happening, it flickers even more now tho.


This is how it looks (hard to see)

	"$basetexture" "bacon"
	"$translucent" 1

That should have worked. I don’t know what directory that .vmt is in, but make sure the one on your client is like that as well. (In garrysmod/materials/ or yourgamemode/content/materials/)

Other than that I’m baffled that it didn’t work. Try remaking it I guess.

Seems to have fixed itself somehow, working for others now too. Thanks for the help :).