It seems that before his discussion with his father's ghost, Hamlet must have been close to his mother and loved her. He had been in a relationship with Ophelia and loved her also. However, after Hamlet discovers his mother's role in his father's murder, along with her quick marriage to his uncle, he loses his trust in women. He feels betrayed! Hamlet is the epitome of what could happen when a son loses all trust and faith in a murderous and adulterous mother. That distrust in her affects the other relationship he had with Ophelia.
The fact that Polonius is discovered by Hamlet to be manipulating Ophelia only makes matters worse for him to be able to trust anyone again. Hamlet is angry that Ophelia allows her father to manipulate her and to set him up in a scene designed to guess his state of mind. Hence, Hamlet goes off on Ophelia and declares his opinions on women and marriage so that his uncle and everyone else listening can hear.
"I have heard of your paintings too, well enough. God/
hath given you one face, and you make yourselves another./
You jig, you amble, and you lisp; and nickname God's creatures/
and make your wantonness your ignorance. Go to, I'll/
no more on't! it hath made me mad. I say, we will have no/
more marriages. Those that are married already—all but/
one—shall live; the rest shall keep as they are. To a nunnery" (III.i.151-157).
The first two lines of the above-listed quote could be about how women use make-up to paint their faces. It also has reference to how women act one way in private and in another way in public when he says that women tend to change their true faces that God has given them and make themselves another. Hamlet goes on that this behavior of changing one's true face to seem like another is deceitful and it drives him crazy. Ophelia bears the burden of this tantrum, but Hamlet is speaking of his mother mostly since he knows he's being spied on. Hamlet's solution to this problem is that marriage should be done away with so men don't get hurt, and that Ophelia should be a nun so she can live a true life.