Results 1 to 6 of 6

Thread: Polygonoffset mode

  1. #1
    Member Newbie
    Join Date
    May 2008
    Posts
    36

    Polygonoffset mode

    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?

    Regards,

  2. #2
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: Polygonoffset mode

    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).

  3. #3
    Senior Member Regular Contributor
    Join Date
    Oct 2009
    Posts
    463

    Re: Polygonoffset mode

    There are separate enables for POINT/LINE + FILL, that you might have forgotten to set for your outlines:
    Code :
    glEnable/glDisable(GL_POLYGON_OFFSET_POINT);
    glEnable/glDisable(GL_POLYGON_OFFSET_LINE);
    glEnable/glDisable(GL_POLYGON_OFFSET_FILL);

  4. #4
    Member Newbie
    Join Date
    May 2008
    Posts
    36

    Re: Polygonoffset mode

    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)


  5. #5
    Member Newbie
    Join Date
    May 2008
    Posts
    36

    Re: Polygonoffset mode

    Any comments will be appreciated?

  6. #6
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789

    Re: Polygonoffset mode

    Google for "hidden line removal" for a few options here.

Similar Threads

  1. PolygonOffset state and the depth test
    By DmitryM in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 04-17-2012, 11:15 AM
  2. PolygonOffset and triangles Normals
    By devdept in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-08-2006, 08:08 AM
  3. polygonOffset and depthMask
    By podjo in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-04-2005, 02:21 PM
  4. Shadow Mapping and PolygonOffset
    By Nakoruru in forum OpenGL: Advanced Coding
    Replies: 10
    Last Post: 10-15-2002, 10:06 AM
  5. PolygonOffset and SGI Hardware
    By dpbradly in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 12-20-2000, 08:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean