Theory of exciton-polariton generation by two-photon absorption