Drawing outline of intersecting circles

后端 未结 2 1733
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条回答
  •  心在旅途
    2021-02-20 04:13

    First, imagine the background was not there. I'm pretty sure you'd know how to do it, draw each circle then draw their insides (as in a filled circle) to remove the arcs that are inside.

    Now to do the same over an image, you could do either of these things. One thing you can do is to disable writing on the color buffer, do that procedure and change the stencil buffer. Then enable writing on the color buffer and draw a whole screen rectangle which consequently fills the pixels you have marked in the stencil buffer.

    The stencil buffer may not be usable to you however for a couple of reasons, such as you are using it for something else. In this case, an alternative would be to do the same thing, but instead of rendering in the stencil buffer, you render in a texture. Then bind that texture and draw a rectangle on the screen.

    I'm quite certain you could achieve this with the accumulation buffer too, but I have never used it so I can't really tell (if anyone knows about that, please edit my answer and tell us how)

提交回复
热议问题