Open Khubajsn opened 11 years ago
Which rendering hooks? All of them? Any of them? Does the error go away when the error is fixed? Do you need to restart GMod to fix it?
I assume any of the 3D rendering hooks. Last two questions: No, Yes.
It happened to me yesterday while using HUDPaint / RenderScreenspaceEffects. I tried to reproduce it to bring further information, but failed. Please consider posting in the thread as oubliette might know more.
There's another thread about this problem on Facepunch, but there's not really much new: http://facepunch.com/showthread.php?t=1268425
Occurred to me today once again, in a SWEP:DrawHUD hook.
function SWEP:DrawHUD()
-- self.Attachments is a table generated in SWEP.Think
if (not self.Attachments or #self.Attachments == 0) then
return;
end;
if (IsValid(self.AttachmentsEntity)) then
halo.Add({self.AttachmentsEntity}, Color(100,255,100), 5, 5, 1, true, false);
end;
for k, v in pairs(self.Attachments) do
surface.SetDrawColor(Color(0,255,0));
local pos = v.data;
if (type(pos) ~= "Vector") then
if (v.type == "bone") then -- v.data is a bone index if v.type is bone
pos = self.AttachmentsEntity:GetBonePosition(pos);
elseif (v.type == "attachment") then -- v.data is attachment ID if v.type is attachment
pos = self.AttachmentsEntity:GetAttachment(pos).Pos;
end;
end;
local scr = pos:ToScreen();
PrintTable(scr); print("");
surface.DrawRect(scr.x - 5, scr.y - 5, 10, 10);
end;
end;
While studying the nonsense output, I've noticed there's a pattern - the values do repeat. Take a look yourself. Pick a X/Y coordinate value and Ctrl+F for it. Is there anything I could do better to help resolve this problem?
Neither of the 'changelevel' and 'reload' fix this from happening. I've indeed had to restart the whole game to get rid of the problem.
@robotboy655 Test seems to suggest that this has been fixed since then.
Unlikely it was fixed if it wasn't looked into. Large numbers usually indicative of the 3D point being offscreen. Perhaps the Lua error that occurred somehow changed the WorldToScreenMatrix irreversibly.
http://facepunch.com/showthread.php?t=1306031&p=42130766&viewfull=1#post42130766