I agree -- you are not a failure, and try to find some reassurance that this will pass in time...
My son, who is almost 6 now, was up until about 4 months ago still pooping in his pants constantly. At home, in the living room, sometimes 3 feet away from the bathroom. It seems it would just come on him suddenly and he wasn't paying very good attention. It was happening every day for a long stretch, I was soaking his pants and underwear, and watching the toilet get stopped up. Ugh, nothing made me more frustrated because I knew he was able to do it, I thought he just wasn't paying attention. But ability and control have a lot to do with it too.
I think we started to turn a corner to success when I did two things -- first, I changed his clothes and cleaned him up without comment, trying very hard not to show any emotion about what happened. He clearly started to feel better when the negative vibe was gone, and it made it easier for us both to be matter-of-fact about it.
And second, I became more vigilant about noticing when he had to go and making him hit the bathroom. It still happens-- he'll be crouching, or talking strangely, or visibly straining and I send him in to "try", and he always needs to go. I say it very plainly, but I will use the words that I notice his behavior and link it to the need to go, which I think reinforces the connection for him.
I would say stop all the positive reinforcement of presents or whatever. Ultimately, being able to take care of his own body will be its own reward. And he shouldn't be "punished" by having to clean himself up; he'll probably do better faster if he knows he has your help and support as he is trying to learn. It's a hard path for many boys, but with all the patience you can muster, he has a better chance of mastering it quickly. I'm finding that now with bed-wetting too, which has been an ongoing issue, but the more I play down the incidents, the less they happen. Although I do manage a quick "hey, you kept your PJs dry, nice job."
And you can always send him to school in pull-ups, but see if you can't encourage him to use the toilet before leaving home in the morning, just as part of the normal getting-ready-to-leave-the-house routine.