We use gradient Young measures generated by Lipschitz maps to define a relaxation of integral functionals which are allowed to attain the value +∞ and can model ideal locking in elasticity as defined by Prager in 1957. Furthermore, we show the existence of minimizers for variational problems for elastic materials with energy densities that can be expressed in terms of a function being continuous in the deformation gradient and convex in the gradient of the cofactor (and possibly also the gradient of the determinant) of the corresponding deformation gradient. We call the related energy functional gradient polyconvex. Thus, instead of considering second derivatives of the deformation gradient as in second-grade materials, only a weaker higher integrability is imposed. Although the second-order gradient of the deformation is not included in our model, gradient polyconvex functionals allow for an implicit uniform positive lower bound on the determinant of the deformation gradient on the closure of the domain representing the elastic body. Consequently, the material does not allow for extreme local compression.