  We show that a phase-only spatial light modulator can be used to generate
non-trivial light distributions suitable for trapping ultracold atoms, when the
hologram calculation is included within a simple and robust feedback loop that
corrects for imperfect device response and optical aberrations. This correction
reduces the discrepancy between target and experimental light distribution to
the level of a few percent (RMS error). We prove the generality of this
algorithm by applying it to a variety of target light distributions of
relevance for cold atomic physics.
