PistonDevelopers / graphics

A library for 2D graphics, written in Rust, that works with multiple back-ends
MIT License
479 stars 55 forks source link

Add `Stencil::Increment` #1138

Closed bvssvni closed 3 years ago

bvssvni commented 3 years ago

Stencil::Clip does not always work, such as hierarchical UI. Applying nested clipping pollutes the stencil buffer.

Stencil::Increment is used with nested clipping. Can use Stencil::Inside(depth) to draw inside at depth.

Stencil::Increment should correspond to the following OpenGL commands:

gl::StencilFunc(gl::NEVER, 0 as gl::types::GLint, 255);
gl::StencilMask(255);
gl::StencilOp(gl::INCR, gl::KEEP, gl::KEEP);
bvssvni commented 3 years ago

It works! Closing.