Put ice into a glass,when it melts it doesnt affect the water level,y does global warming cause rising sea lev

If you put a block of ice into a glass of water, when it melts it doesnt affect the water level.why does melting ice caps cause rising sea levels?