From: DeaDDooMER Date: Thu, 16 Feb 2023 18:17:57 +0000 (+0300) Subject: gl: free old map textures before load new textures X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=a5afb39344df669366098dd136c6aad64ce4a712;p=d2df-sdl.git gl: free old map textures before load new textures --- diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 26a15dc..c008f43 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -525,10 +525,22 @@ implementation r_Common_FreeAndNil(Items[i].tex); end; + procedure r_Map_FreeTextures; + var i: Integer; + begin + plist.Clear; + r_Common_FreeAndNil(SkyTexture); + if RenTextures <> nil then + for i := 0 to High(RenTextures) do + r_Common_FreeAndNil(RenTextures[i].tex); + SetLength(RenTextures, 0); + end; + procedure r_Map_LoadTextures; const DefaultAnimInfo: TAnimInfo = (loop: true; delay: 1; frames: 1; back: false); var i, n: Integer; txt: TAnimTextInfo; begin + r_Map_FreeTextures; if Textures <> nil then begin n := Length(Textures); @@ -567,17 +579,6 @@ implementation plist.Clear; end; - procedure r_Map_FreeTextures; - var i: Integer; - begin - plist.Clear; - r_Common_FreeAndNil(SkyTexture); - if RenTextures <> nil then - for i := 0 to High(RenTextures) do - r_Common_FreeAndNil(RenTextures[i].tex); - SetLength(RenTextures, 0); - end; - procedure r_Map_DrawPanel (p: TPanel); var Texture: Integer; t: TGLMultiTexture; tex: TGLTexture; count, frame: LongInt; a: TAnimInfo; begin