I review recent results on a novel method for generating helical waves of visible light based on inhomogeneous birefringent plates made of a suitably patterned liquid crystal. These devices, dubbed "q-plates", act on the light wave by converting its spin angular momentum into orbital angular momentum, an optical process not envisioned before. The output helical wave can be easily and rapidly switched between opposite wavefront helicities by switching the input polarization with standard electro-optics devices. The process can be cascaded, so that rapid switching can take place among multiple values of the wavefront helicity. More generally, patterned liquid-crystal devices similar to those realized for generating helical beams may be used for shaping the optical wavefront in any prescribed way, with the possibility of dynamical polarization multiplexing between conjugate wavefronts. This is an application of the Pancharatnam-Berry phase principle, allowing the realization of a novel kind of optical elements for wavefront shaping. Potential developments in the fields of optical communication and quantum computation are briefly discussed.