I read somewhere in a relativity article that light speed is constant and it is impossible for a photon to not travel at speed of light. Now i study in year 10 and today i studied that light speed can change in different material like glass and water. so how does that work?
Einstein's two postulates of Special Relativity: 1. The laws of physics are invariant in all inertial systems. 2. The speed of light in a vacuum is the same for all observers, regardless of the motion of the light source relative to the observers.
So the context is important that the speed of light in a vacuum never changes.
From the wave equation (http://maxwells-equations.com/equations/wave.php), c = (mu*epsilion)^(-1/2), where mu (epsilion) is the permeability (permittivity).
The speed of light does slow down in a medium, as described by the above equation. As light passes through a medium, the electric and magnetic fields of the photon oscillate electrons in the medium (at the frequency of the light wave), and those electrons respond by radiating electromagnetic waves at the same frequency, but with a time delay, and these EM waves constructively and destructively interfere with the incident light wave, reducing the light wavelength but maintaining the light frequency, and effectively reducing the phase velocity of light(https://en.wikipedia.org/wiki/Refractive_index#Microscopic_explanation).