The water vapor in the relatively warmer, and more moist air condensed, hence fogging your glasses. Warm moist air comes in contact with a colder surface, you get condensation.
Warm air turns water from gas to liquid faster than cold air, so when he quickly go from cold to warm, the water vapor will suddenly turn to its solid form, causing glasses to fog.