PDA

View Full Version : Rendering frame and filled faces simultaneously



OlegOleg
03-22-2012, 09:37 AM
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:
http://i.piccy.info/i7/755c85f6a9da922d104284ea70e92cb7/1-5-5994/45169892/needed.png

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:
http://i.piccy.info/i7/ffde3b6846559e5df74095ab142d275f/1-5-5994/62150373/actual.jpg
http://xmages.net/storage/10/1/0/1/5/upload/1a407a59.png

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?

carsten neumann
03-22-2012, 11:59 AM
Take a look at glPolygonOffset (http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml).