Announcement

Collapse
No announcement yet.

Outlined Polygons

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Outlined Polygons

    In gbSTL the code makes it particularly easy to do this, create an object whose triangles are outlined with a user-specified color ...



    In OpenGL, I expected (yes, I know, my list of expectations is growing ) that surely the same thing would be just as easy, or easier!

    But, NO! There are no settings which provide that result. In rendering polygons you have point, lines or surfaces - by not a combination of both!

    There is, of course a work around. You can use the polygon offset feature, then draw the object twice - once as a solid and then once as a wire version right on top of the solid version ... as in this example with a glutSphere ...



    That seems like an ok solution, except that it essentially halves the frame speed. Fine for small objects, but not for 1M polygon sized images.

    I'm just surprised there wasn't an option in OpenGL to get the results without the penalty of drawing objects twice!

    Code:
       glColor3d (1, 1., .7)
       glEnable %gl_polygon_offset_fill
       glPolygonoffset(1.0,1.0)
       glColor3ub 255,0,0           'ub = unsigned byte = 8bit unsigned integer  gbColor3f = float 0-1
       afxglutSolidSphere 40,40,40
       glColor3ub 0,0,0           'ub = unsigned byte = 8bit unsigned integer  gbColor3f = float 0-1
       afxglutWireSphere 40,40,40
    Perhaps in my beginner mode, I've missed a better solution?
    Last edited by Gary Beene; 29 Oct 2015, 08:48 PM.

  • #2
    Dear Gary,

    I would suggest to create own routines for rendering the objects, sphere in this case. It might be the case that the sphere rendering routine uses immediate mode (glBegin/glEnd), which is no no performance wise due to excessive number of calls, making it CPU bound.

    If you get half the framerate for drawing object twice at the same location, you are probably CPU bound, not GPU bound.

    Before you dive into vertex arrays and other magic, you might try to cache the geometry to display list first, then draw it twice with glCallList and see, if it helps.


    Petr
    [email protected]

    Comment

    Working...
    X