Drawing outline of intersecting circles

后端 未结 2 1783
Happy的楠姐
Happy的楠姐 2021-02-20 03:32

I have a set of points and each one has an area of \"influence\" or essentially a radius. I would like to be able to draw each one of these influence circles for all the points

2条回答
  •  萌比男神i
    2021-02-20 04:13

    Two passes:

    1. Draw all your circle outlines via GL_LINES or GL_LINE_LOOP. Make sure you set your glLineWidth() to 3 or greater.
    2. Draw filled circles (GL_TRIANGLE_STRIP can be useful) with your "background" color and the same radius as the circles from step 1.

    The filled circles in step 2 will overwrite all the outline pixels from step 1 but only where they overlap. That leaves you with non-overlapping outlines intact.

    If you want a wider range of outline widths (i.e., greater than the ~10 that most OpenGL implementations allow glLineWidth()) you should reuse the filled-circle renderer from step 2 in step 1 except with a larger radius.

提交回复
热议问题