In Survival or Creative mode, when inside of a transparent block (such as leaves or glass), the screen is overlayed with an opaque texture of that block that cannot be seen through.
This happens for example when riding through leaves on a horse.
Being inside of glass blocks shows a black screen
Non-suffocatable blocks vision glitch
Horse Riding Visual Glitch