Spain invested billions in its solar-power grid; Germany claimed to get most of its power from renewables.