Using the concept of generalized Wannier functions, adapted form the electronic theory of solids, we demonstrate for two-dimensional photonic crystals the existence of a localized state basis and we establish an efficient computational method allowing a tight-binding-like parameter free modelization of any dielectric structure deviating from periodicity. Examples of numerical simulations using this formalism, including modal analysis of microcavities and waveguides and calculaitons of the transmission coeffcicients are presented to prove the ability of this approach to dela accurately with large scale systems and complex structures.