When you shine light on a material, you are bombarding it with photons. Photons have a specific energy according to the frequency of light they make up. What determines how photons interact with a material is their frequency, along with how the electrons in that material are arranged. Electrons can occupy different energy levels, the lowest of which is called the ground state.
In opaque materials, photons of visible light are mainly absorbed by electrons in the material. The electron then uses the photon’s energy to jump to a higher energy state. In the case of glass, the amount of energy needed to raise an electron to the next energy level is higher than most materials and the photons of visible light do not have enough energy to bridge this gap, so the photons pass through.
Answered by Rik Sargent