• DrawTexturedRect Bug
    3 replies, posted
Hello! So im attempting DrawTexturedRect and its not exactly working.. I have the image but there is a bug.. heres a video to show.. heres my code as well [video=youtube;qkBkExBogz4]https://www.youtube.com/watch?v=qkBkExBogz4&feature=youtu.be[/video] [code] function DDGLogo() local ply = LocalPlayer() if !ply:Alive() then return end local ourMat2 = Material( "vgui/logo/ddglogo" ) surface.SetDrawColor( 255, 255, 255, 255 ) surface.SetMaterial( ourMat2 ) local x = ScrW() / 2 - 250 local y = 10 surface.DrawTexturedRect( x, y, 500, 80 ) end hook.Add("HUDPaint", "DDGLogo", DDGLogo) [/code]
You are suppose to use the Material function ONCE, not every frame. Not only does this really mess up performance but it will bug out like you showed. Make the local variable outside of the hook or check if it already exists, instead.
Also make sure the shader for the material is UnlitGeneric for gui materials
Or just use a .png texture.
Sorry, you need to Log In to post a reply to this thread.