A display device includes a scanned projector for projecting a beam of light, and a diffraction grating for dispersing the light at a plurality of angles into a waveguide, wherein at least a portion of the diffraction grating includes a nanovoided polymer. Manipulation of the nanovoid topology, such as through capacitive actuation, can be used to reversibly control the effective refractive index of the nanovoided polymer and hence the grating efficiency. The switchable grating can be used to control the amount of diffraction of an incident beam of light through the grating thereby decreasing optical loss. Various other methods, systems, apparatuses, and materials are also disclosed.