Nonnegative forms and sums of squares on a real projective variety are fundamental objects in real algebraic geometry. We are interested in finding conditions that the sets of nonnegative forms and sums of squares are the same and expressing the differences between them. If X is a totally real irreducible nondegenerate projective variety, every nonnegative quadratic form on X is a sum of squares if and only if X is a variety of minimal degree. Furthermore, if X is a totally real nondegenerate projective variety, the same property holds if and only if the Castelnuovo-Mumford regularity of X is 2. We classify that such varieties are linear joined consisting of varieties of minimal degree in their linear span. If there is a sum of square, which is not a nonnegative form on X, we find the differences of dimensions between faces determines by the same hyperplane. We define the Gap vector of X whose entries are the dimension differences and confirm some general properties. Finally, we introduce a new invariant called the quadratic persistence.