hedgewars/uLand.pas
changeset 797 e7fa1a1b9791
parent 769 788efc1d649f
child 827 ee4fa9ff2a7b
equal deleted inserted replaced
796:81057bc8a02e 797:e7fa1a1b9791
   633 procedure UpdateLandTexture(Y, Height: LongInt);
   633 procedure UpdateLandTexture(Y, Height: LongInt);
   634 var i: integer;
   634 var i: integer;
   635 begin
   635 begin
   636 if LandTexture <> nil then
   636 if LandTexture <> nil then
   637    begin
   637    begin
       
   638    if (Height <= 0) then exit;
       
   639    TryDo((Y >= 0) and (Y < 1024), 'UpdateLandTexture: wrong Y parameter', true);
       
   640    TryDo(Y + Height < 1024, 'UpdateLandTexture: wrong Height parameter', true);
   638    glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
   641    glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
   639 
   642 
   640    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);
   643    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);
   641    end else
   644    end else
   642    begin
   645    begin