Dispersion only depends on the glass material, not its shape. However the triangular prism has a shape maximising the effect of refraction: each wavelength in an incoming white light entering the prism is first refracted when entering the prism, thus travelling at a specific angle within the glass, then refracted again when exiting the prism. The overall effect is a nice rainbow-like angular dispersion of all wavelengths of the incoming light.
If you do not have refraction at all (flat glass hit at right angle) or only little of it (lenses) the effect of dispersion is much less visible because there is less (or no) eventual angular separation of the different wavelengths.