Gamma-convergence of constrained Dirichlet functionals