hedgewars/uLandTexture.pas
branchqmlfrontend
changeset 10748 dc587913987c
parent 10648 75498cfe6267
child 11046 47a8c19ecb60
equal deleted inserted replaced
10616:20a2d5e6930a 10748:dc587913987c
   167                         if tex = nil then tex:= NewTexture(TEXSIZE, TEXSIZE, Pixels(x, y));
   167                         if tex = nil then tex:= NewTexture(TEXSIZE, TEXSIZE, Pixels(x, y));
   168                         glBindTexture(GL_TEXTURE_2D, tex^.id);
   168                         glBindTexture(GL_TEXTURE_2D, tex^.id);
   169                         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEXSIZE, TEXSIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pixels(x,y));
   169                         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TEXSIZE, TEXSIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, Pixels(x,y));
   170                         end
   170                         end
   171                     else if tex <> nil then
   171                     else if tex <> nil then
   172                         begin
   172                         FreeAndNilTexture(tex);
   173                         FreeTexture(tex);
       
   174                         tex:= nil
       
   175                         end;
       
   176 
   173 
   177                     // nothing else to do
   174                     // nothing else to do
   178                     if dirtyLandTexCount < 1 then
   175                     if dirtyLandTexCount < 1 then
   179                         exit;
   176                         exit;
   180                     end
   177                     end
   282 var x, y: LongInt;
   279 var x, y: LongInt;
   283 begin
   280 begin
   284     for x:= 0 to LANDTEXARW - 1 do
   281     for x:= 0 to LANDTEXARW - 1 do
   285         for y:= 0 to LANDTEXARH - 1 do
   282         for y:= 0 to LANDTEXARH - 1 do
   286             with LandTextures[x, y] do
   283             with LandTextures[x, y] do
   287                 begin
   284                 FreeAndNilTexture(tex);
   288                 if tex <> nil then
       
   289                     begin
       
   290                     FreeTexture(tex);
       
   291                     tex:= nil
       
   292                     end
       
   293                 end;
       
   294 end;
   285 end;
   295 
   286 
   296 procedure freeModule;
   287 procedure freeModule;
   297 begin
   288 begin
   298     ResetLand;
   289     ResetLand;