• disappearing hud elements
    11 replies, posted
so whenever I open chat or a vgui menu, some of my hud elements disappear, but only ones that use scissor rects, how do i stop this from happening?
Post the code first. It's rather funny that someone rated you informative even thought your post lacks the most basic info we need.
[lua] render.SetScissorRect( (ScrW()/2) - ArmorDR/2, ScrH()/1.1, (ScrW()/2) + ArmorDR/2, ScrH(), true ) surface.SetDrawColor( Color( 0, 0, 200 ) ) surface.DrawPoly( ArmorBG ) render.SetScissorRect( 0, 0, 0, 0, false ) [/lua] sorry, here.
You have to set the texture for DrawPoly. If you don't want one then do draw.NoTexture() before the DrawPoly.
[QUOTE=hemirox;42608993]You have to set the texture for DrawPoly. If you don't want one then do draw.NoTexture() before the DrawPoly.[/QUOTE] I used surface.DrawColor. The problem only happens when i open chat, and is gone when i close chat.
[QUOTE=jack10685;42609143]I used surface.DrawColor. The problem only happens when i open chat, and is gone when i close chat.[/QUOTE] surface.DrawPoly requires a texture to be set. Other HUD elements (including engine-internal ones) are probably setting a texture before your call to surface.DrawPoly is reached, except for when the chatbox is opened, making it appear that you aren't using a texture while you are really just using the texture set by some other code. Calling surface.SetTexture without any arguments or draw.NoTexture will fix the problem if this is the issue.
[QUOTE=Willox;42609230]surface.DrawPoly requires a texture to be set. Other HUD elements (including engine-internal ones) are probably setting a texture before your call to surface.DrawPoly is reached, except for when the chatbox is opened, making it appear that you aren't using a texture while you are really just using the texture set by some other code. Calling surface.SetTexture without any arguments or draw.NoTexture will fix the problem if this is the issue.[/QUOTE] this gets rid of the color entirely, I don't think you understand what is happening. I am trying to make it to where a certain hud element draws in a specific color, defined in the code I put, BUT, when I open chat, the color goes away for no reason. Using draw.NoTexture() gets rid of it entirely (the opposite of what i want)
bump
Do what hemirox said. [lua] draw.NoTexture() surface.SetDrawColor( 0, 0, 0, 200 ) surface.DrawPoly( Polygon ) [/lua]
You can do [lua]surface.SetMaterial(Material('vgui/white'))[/lua]
neither of those are working :|
I have tried setting materials, textures, and colors all in different combinations, but nothing works. Nothing any of you guys have recommended works, so i don't know what to do. [url="http://pastebin.com/kB1JkVi2"]Here is the code[/url], if you can find any problems and fix it, be my guest, but i can't find any.
Sorry, you need to Log In to post a reply to this thread.