hedgewars/uLand.pas
changeset 769 788efc1d649f
parent 768 2886dafa5bcf
child 797 e7fa1a1b9791
equal deleted inserted replaced
768:2886dafa5bcf 769:788efc1d649f
   638    glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
   638    glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
   639 
   639 
   640    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);
   640    glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]);
   641    end else
   641    end else
   642    begin
   642    begin
       
   643    TryDo(LandSurface <> nil, 'Assert (LandSurface <> nil) failed', true);
   643    LandTexture:= Surface2Tex(LandSurface);
   644    LandTexture:= Surface2Tex(LandSurface);
   644 
   645 
   645    if SDL_MustLock(LandSurface) then
   646    if SDL_MustLock(LandSurface) then
   646       SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
   647       SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
   647 
   648 
   648    Move(LandSurface^.pixels^, LandPixels, 2048 * 1024 * 4);
   649    Move(LandSurface^.pixels^, LandPixels, 2048 * 1024 * 4);
   649 
   650 
   650    if SDL_MustLock(LandSurface) then
   651    if SDL_MustLock(LandSurface) then
   651       SDL_UnlockSurface(LandSurface)
   652       SDL_UnlockSurface(LandSurface);
       
   653 
       
   654    SDL_FreeSurface(LandSurface);
       
   655    LandSurface:= nil
   652    end;
   656    end;
   653 
   657 
   654 end;
   658 end;
   655 
   659 
   656 initialization
   660 initialization