Drawing images onto stencils?

Issue #1261 wontfix
created an issue

I'm aware that drawing images onto stencils is already possible via shaders, but would it be possible natively (or "sneaking" in the shaders code into LÖVE)? From my understanding it seems unlikely, maybe even impossible, but I figured it wouldn't hurt asking

Comments (1)

  1. Alex Szpakowski

    Rendering to a stencil is fundamentally a binary 'enable/disable this pixel' operation.

    You can draw an image to the stencil buffer without a shader right now, but it will behave the same as if you draw a rectangle to the stencil.

    You could use a shader to determine whether the stencil value at each pixel is enabled based on the image's alpha (or maybe even the image's alpha multiplied with the current color's alpha), but I don't think it's a good idea for love to do that automatically with its default shader – it impacts performance and it wouldn't know what you want to do with semitransparent colors.

  2. Log in to comment