Piecewise polynomial approximation on optimal meshes