From aerogel to compact glasses: effect of the density