I've acquired a tan while swimming and while sitting indoors in the sun. (In fact I've got burnt, because I didn't know it was possible and didn't put cream on.) It's slower, apparently, but it can be done
Glass is generally very good at stopping uv rays, it does however depend on the quality of the glass. Glass produced for cars is generally tempered compared to household glass. Hence less chance of burning in your car than in your bedroom.
Water is not as good as glass, however the deeper you are the better, drops of water on your skin however will not prevent burning and infact could make it worse.