Let’s say I have a background image/material, take this one as an example (it’s 15x15 if that matters):
How would I go about using it in a significantly larger panel (e.g. 800x600) as a background tile - is it possible to use some already existing function in GLua? I found surface/DrawTexturedRect, but I find it’s documentation very vague as I have only very little knowledge in textures/materials.
Of course, I could make a custom paint function which would draw the tile manually, but something tells me it’d be terribly slow - EDIT: going to try it before I continue complaining about it’s speed - EDIT: I tried and it was lagging my derma quite a bit - tried 5x5 and 15x15 sized tile textures.
function ff:Paint(w, h)
local x = 0;
local y = 0;
surface.SetMaterial(self.Mat); surface.SetDrawColor(Color(255,255,255)); while (y < h) do x = 0; while (x < w) do surface.DrawTexturedRect(x, y, self.MatW, self.MatH); x = x + self.MatW; end; y = y + self.MatH; end; return true;