DEADSOFTWARE

gl: fix big textures on hardware with texture limits
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 28 Dec 2022 14:06:42 +0000 (17:06 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 09:07:22 +0000 (12:07 +0300)
src/game/renders/opengl/r_draw.pas

index 55d9dad6432db0bc2d1832aa6a3fc8af3fee831c..1b1c6262bdf17196cfabf8e88714e664c512d54b 100644 (file)
@@ -137,22 +137,24 @@ implementation
     begin
       offx := 0;
       offy := 0;
+      glPushMatrix;
+      glTranslatef(x, y, 0);
+      glScalef(w / img.width, h / img.height, 1);
       for j := 0 to img.lines - 1 do
       begin
         for i := 0 to img.cols - 1 do
         begin
           n := img.GetTile(i, j);
           ASSERT(n <> nil);
-          glPushMatrix;
-          glTranslatef(x + offx, y + offy, 0);
-          glScalef(w / img.width, h / img.height, 1);
           DrawTile(n, 0, 0, n.width, n.height, flip, r, g, b, a, blend);
-          glPopMatrix;
+          glTranslatef(n.width, 0, 0);
           offx := offx + n.width;
         end;
+        glTranslatef(-offx, n.height, 0);
         offx := 0;
         offy := offy + n.height;
       end;
+      glPopMatrix;
     end
   end;