Rendering frame and filled faces simultaneously

Hi everybody!
My problem is the following. I have to render model’s frame and faces at the same time for they to look like this:

I’m trying to render the faces first (using GL_QUADS) and then frame (GL_LINES), but picture I get isn’t proper because frame lines are broken and ungly, and when face is looked from right angle frame isn’t visible at all:

I tried to set depth function to ‘less or equal’ but it doesn’t work too. As far as I understand it’s due to round-off errors during vertex transformations .

Also I tried to render frame a bit moved towards viewpoint. It helped to some extent, but result is still unsatisfactory. How can I fix it?

Take a look at glPolygonOffset.