Hi all I need some wise advice. I am making my first gamemode, a friend has made an awesome image to use for a HUD overlay. But I am having a few issues with it. I am using this block of code in order to display it on the screen.
function headhud()
local HUD = surface.GetTextureID("materials/overlays/sLayer.png")
surface.SetTexture(HUD)
surface.SetDrawColor(255,255,255)
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
end
hook.Add("HUDPaint", "headhud", headhud)
I have tried it with a .jpg and vtf and still the same issue. The issue I am having is the black and purple missing texture.
[url]https://drive.google.com/file/d/0B9mYOB0Vx8UdekZjVGVQRGR1WTg/edit?usp=sharing[/url]
I have made sure to make the client download the file.
resource.AddFile("materials/overlays/sLayer.png")
If I have posted this is the wrong part of the forums I am sorry. Any help you can give me will be greatly appreciated.
Thanks
-Duby
I don't know if GetTextureID works with .PNG files. You could try creating a local variable that is like
[code]local matOverlay = Material("overlays/sLayer.png");[/code]
then using surface.SetMaterial instead of SetTexture. But remember, [b]don't[/b] use [i]Material[/i]() within any hooks that are called each frame.
Hmm this is interesting and helpful. But I am still having the same texture error.
Use render.SetMaterial and Material functions for .png images.
Snippers
Sorry, you need to Log In to post a reply to this thread.