View Full Version : Polygonoffset mode

03-27-2011, 02:06 AM
Hi all,

Is that glPolygonOffset mode is valid only for objects comprised with gl_polygon and is futile to call it for solid objects created with gl_lines,gl_triangles, gl_quads, gl_trianglefans etcc?

Purpose is to create outlining lines of solid object, if it's comprised from triangles, trianglefans, quads and quadstrips.
Does that mean the unnecessary lines will be drawn as well?

What happens to shared edges if I used the polygon to draw solid and glPolygonOffset mode for outlining?


03-27-2011, 06:50 AM
Polygon offset is valid for any primitive type; I don't know where you got that information from. There are gotchas relating to invariance, the non-linearity of the depth buffer and the fact that polygon offset is allowed to be implementation dependent that make it somewhat less appealing than you sometimes see it presented as being.

That's a very complex model you're drawing; any particular reason why you can't just collapse all the geometry to a single indexed triangle list? It will draw a lot faster, and make life easier too when you come to do outlines (having a single consistent primitive type will help to isolate potential sources of problems - is this glitch because I'm not removing hidden lines correctly or is it because I was using a quadfan and I'm now using a triangleloop? Etc).

Dan Bartlett
03-27-2011, 07:05 AM
There are separate enables for POINT/LINE + FILL, that you might have forgotten to set for your outlines:


03-27-2011, 01:31 PM
Polygon offset is valid for any primitive type; I don't know where you got that information from.
Ok, based on the naming convention I thought that polygonoffset is just for polygons.

Probably I wasn't clear enough to describe the problem,
I'm breaking down the complex solid structure to relatively simple shapes (mostly drawn with gl_triangles), If I understand it correctly Polygonoffset is supposed to offset the each line segment pushed away or pulled toward me depending on arguments factor and units.

Assume on that image that each individual triangle is drawn with gl_triangles, I want to outline the thick black and yellow line around 1st and 2nd objects.
1. What happens to red lines if use PolygonOffset, drawn or not?
2. What happens to yellow line which is shared edge, is it drawn twice? (once for 1st object and once again for 2nd object)


03-28-2011, 01:40 AM
Any comments will be appreciated?

03-28-2011, 02:05 AM
Google for "hidden line removal" for a few options here.