Surface.DrawPoly skipping frames

I’m currently working on a project where I’m trying to draw a rectangle on a panel using Surface.DrawPoly.
But I’m having problems with that the rectangle won’t draw directly. It skips a few frames until it starts to draw.

Code snippet (Removed comments and other unnecessary stuff)

local PanelWidth = ScrW() * 0.33

local TriSideLengths = PanelWidth * 0.3

local TriUpperLeft = {
	{x = 0, y = 0},
	{x = TriSideLengths, y = 0},
	{x = 0, y = TriSideLengths}

self.Frame.Paint = function(_,w,h)



Try calling

draw.NoTexture before calling surface.DrawPoly.

Works perfect!
But why is that? I haven’t set a texture anywhere?

Textures set by other things drawing

Yea. That makes sense.
But it only affects drawpoly. Drawpoly is not drawing a texture, is it?


Nvm… Just read this. "Draws a textured polygon "