It might be worth it to look for a library that does this. I don't know of any so I can't recommend one, but there must be some out there, as this is a very common requirement.
I'm currently learning opengl with the book "Beginning OpenGL Game Programming" and it said that usually game developers prefer to draw triangles than polygons to avoid problems like that one. Though I'm still in chapter 3 and I don't know much yet.
Good luck!
[edit]
Oh crap! I should have check Disch's link first, well maybe that's it. Triangle is the solution.