hedgewars/uLandTexture.pas
changeset 10634 35d059bd0932
parent 10494 0eb97cf4c78e
child 10648 75498cfe6267
equal deleted inserted replaced
10633:2f062fac5791 10634:35d059bd0932
   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
       
   288                 if tex <> nil then
   284                 if tex <> nil then
   289                     begin
   285                     FreeAndNilTexture(tex)
   290                     FreeTexture(tex);
       
   291                     tex:= nil
       
   292                     end
       
   293                 end;
       
   294 end;
   286 end;
   295 
   287 
   296 procedure freeModule;
   288 procedure freeModule;
   297 begin
   289 begin
   298     ResetLand;
   290     ResetLand;