Team Spartan Cookies & Milk Forums
Stencil bug with render.drawFilledCircle() - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Starfall (https://teamscm.co.uk/forum-7.html)
+--- Thread: Stencil bug with render.drawFilledCircle() (/thread-3220.html)



Stencil bug with render.drawFilledCircle() - The17thDoctor - 18-04-2020

The stencil function has a problem related to render.drawFilledCircle(), instead of limiting drawing to the circle, it limits it to its bounding box.


RE: Stencil bug with render.drawFilledCircle() - Person8880 - 18-04-2020

This will be fixed after the next restart.


RE: Stencil bug with render.drawFilledCircle() - The17thDoctor - 13-06-2020

I noticed a new problem related to that one case, if on a screen, we try to draw a hollow circle using stencils and alpha 1 filled circle, the stencil would not take in acount the circle itself.
When increasing alpha to a certain number it does draw the inner filled circle but as full opacity.

render.startStencil()
render.setColor(0,0,0,1)
render.drawFilledCircle(862.3015,256.1455,64.5005,64.5005)
render.drawStencil()
render.cutOutStencil()
render.setColor(35,47,55)
render.drawFilledCircle(862.3015,256.1455,91.0105)
render.endStencil()



RE: Stencil bug with render.drawFilledCircle() - Person8880 - 14-06-2020

Yes, this is a limitation with the way the circle is being rendered, as noted in the documentation.

If you want translucency, you'll need to render the translucent circle in the draw part of the stencil, rather than the stencil part.

If you're just trying to make the stencil part not draw anything visible, you can disable colour writing, e.g.
render.startStencil()

-- Use 255 alpha to ensure the circle is actually "drawn". Even though it won't end up visible, alpha is still used.
render.setColor(0,0,0,255)

-- Stop writing colour so this circle is not visible, but still gets applied as a stencil.
render.enableColor(false)

render.drawFilledCircle(862.3015,256.1455,64.5005,64.5005)

-- Re-enable colour and draw whatever else below.
render.enableColor(true)
render.cutOutStencil()

render.setColor(35,47,55)
render.drawFilledCircle(862.3015,256.1455,91.0105)

render.endStencil()



RE: Stencil bug with render.drawFilledCircle() - The17thDoctor - 14-06-2020

Thanks for the tip, i'll remember that one.