I have a specific need, and after looking around, it seems like I have two approaches, but I’m not sure which is better, so I thought I’d ask for comments here.
I am drawing a variety of Windows controls. These are all rectangles, but some will appear as other shapes, such as circles and toroids. Nothing is moving in any of these controls. The whole thing will need to redraw as part of a Paint event, but a circle will always be a circle and a torus will always be a torus. The underlying graphics may or may not have something drawn on them, but if they do or not, what gets drawn will always be in the same place and not moving.
The way I was doing this is using an effect to mask out just the area where the underlying texture is showing through. So, there is an area that is transparent, and an area where the underlying texture is visible. This is then drawn onto another texture (and then something else is drawn over the top, but that’s irrelevant).
My shader isn’t working since moving from XNA4.0 to MG3.8. While looking around for reasons why that might be, I came across some discussion of using the stencil buffer to achieve what appears to be pretty much the same effect. It seems that I’d be slightly better off getting the effect to work, as some controls will need a mask while others will not, and the stencil buffer seems to be set at a higher level than what I’m doing. On the other hand, it looks like I could also just not stencil the rectangular shapes and only stencil the ones that needed cropping.
So, what I’m looking for is a way to decide between using an effect versus using a stencil buffer? What advantages/disadvantages are there for the two approaches?