This before photo shows a vertical wall in an attic insulated with fiberglass insulation. This fiberglass allows hot/cold air to travel through it and touch the drywall, thus allowing the heat and/or cold to transfer into the living space.
The after picture shows the fiberglass removed and newly insulated using closed cell spray foam. This builds a great protective thermal and air barrier and makes the top floor of this home cooler in the summer months.