I can be one of the 2 hungry people who knows where the glass is so I am not going to eat one of those.
I guess this is not the answer that you are hoping for :)
--------
How about.
Let the 2 who know each chose a good peice, then allow them to eat the peice they chose. They are hungry so it they really have chosen a good peice they will eat it and they were telling the truth. If they don't eat it it is because there is glass in that slice and they are lying.
If they both eat it then you can just ask them to sort the good from the bad, they are both telling the truth so they will agree on the out come and the 3 remaining good pieces will be identified.
If neither eat it then they are both liars. You can get them to sort out the 5 good and 5 bad ones
If neither eat it then you can again ask them to sort the good from the bad, they are both lying so they will agree on the out come. The 5 that they say are good are the bad ones
If one eats the cake and one doesn't then it is obvious that the eater is telling the truth and the onther is lying.
Get the truth teller to point out the other 4 good ones.