The best-known telling of the legend of Oedipus is that of Sophocles. It is told in a set of three plays: Oedipus the King, Oedipus at Colonus, and Antigone. It is from this trilogy that we learn that Oedipus blinded himself out of grief.
As an infant, Oedipus had been sent to be abandoned, and certainly die, by his father. However, the order was not carried out and Oedipus attained adulthood without ever knowing the identity of his parents. This set the stage for him to actually kill his father and marry his mother. He fathered two daughters and two sons during this marriage.
Later, when this union - which had been prophesied - came to light, the mother hanged herself. Having learned that he had killed his father, married and bedded his mother, and inclined his mother to take her own life, Oedipus, in his grief, very deliberately blinded himself.
Even today, a rare form of self-harm, whereby a person causes severe injury to their own eyes, is referred to as oedipism.