Stencil cancelled on intersection of shapes
See original GitHub issueHi,
When we use the StencilPush instructions, if we want to define the stencil as a complex shape like a trianle and an ellipse together, on the intersection of the two shapes, the stencil will simply be cancelled.
Example :
StencilPush
Color:
rgba: 1, 0, 0, 1
Rectangle:
pos: 50,50
size: 20, 20
Ellipse:
pos: 50, 55
size: 15, 15
... then all the other stencil instructions...
Expected behaviour : a stencil of the shape of a square.
It actually happen no matter what type of shape we draw in the StencilPush : line, quad, etc. …
The is VERY problematic because it only allow us to use simple shapes or to compute intersection and draw complex shapes instead of simple ones to avoid intersection.
Especially if the stencil position if moving (like the sight of a player in the dark) and we have another shape somewhere on the canvas (let’s say a spot light) then everything will work at the begining… and stop working properly when intersection of the two shapes will happen.
Issue Analytics
- State:
- Created 11 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
The demo is working for what you asked for, but it has a bug cause of a nested usage of Stencil (Done by StencilView here.)
So basically, setting func_op should work for this case, except if you use it inside another widget that use Stencil. (then you might have issues). Sorry about that!
I’ve thinked more about a “mask” possibility, using Fbo + Shader:
Hi Tito,
Sorry for the late reply. So I tested your solution and it is… nearly working.
In fact, it does work when using the KV language, but it does not when using the same instructions from Python directly… Which is, well, an issue because KV part is quite “static” (unless we generate it on the fly and pass it to the Builder but I can help but think of that as nasty).
If you need a demo of non-working code when used from Python vs. Working code when used from KV, tell me. But basically the example code you provided - transcripted to full-python calls code - is enough to spot the bug.