"Pride is not the opposite of shame, but its source." - Iroh
Pride is among the most useless of emotions. Some claim that it motivates them to higher achievement, but there are better motivators. Love. Duty. A desire to simply be better. These all come from within, and all seek virtue. Pride, by caparison, seeks external recognition which is both dangerous and outside one's own control. How far might you drift from your own values when your goal is to measure up to someone else's? How demoralizing it must be to earn praise and have it not be granted. How embarrassing it is to fail, despite your best efforts, to reach pride's lofty goals.
"What's that you say? Hopeless? -- Why, very well! But a man does not fight merely to win!" - Edmond Rostand as Cyrano de Bergerac
If your sense of self-esteem is so battered that you must seek pride, seek pride from what you do, rather from how you are rewarded. Take pride in the effort expended, in the fear overcome, in the tough choice made, in the purity of your intent and the challenge accepted. If others outstrip you or deny you your place, it matters not a whit. If your best wasn't good enough, you can resolve to improve, and know that you left nothing in reserve. You do not need to win. Only to deserve it.
"You have a right to perform your prescribed duty, but you are not entitled to the fruits of action. Never consider yourself the cause of the results of your activities, and never be attached to not doing your duty." - Bhagavad Gita
Better still, do what you know needs to be done, and let the cards fall where they will. You do not know where you will be in five years, and you cannot know what you will want on that day. Who knows what you seek today that will, in fact, be taking your further from where you will later want to be? The bitter rejection you experience next may be the door that leads to your best possible outcome - the one you would never have considered had you gotten what you sought. What nonsense would it be to mourn a dispreferred outcome when it very might be exactly what you needed?
"When I do good, I feel good; when I do bad, I feel bad, and that is my religion." - Abraham Lincoln
To have it all, or at least all that matters, you need do only one thing: Seek the character you admire in others. Not the ribbons and accolades and possessions and status. Those are only side-effects of greatness, not greatness itself. You must, instead, seek the moral traits in these role models that made them paragons of what virtue they possess. The integrity of that one, the loyalty of this one, the diligence of the other - whatever character it is to which you aspire. Act like the man you would admire, and you will never know shame.
"If anything is possible for man, and peculiar to him, think that this can be attained by thee." - Marcus Aurelius
If you ever again find your self wallowing in shame, you must recognize that your pride has very likely led you there. Discard it. It serves you poorly. Lose the pride, lose the shame, do the one thing. You will be magnificent.