17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust
MIT License
917 stars 63 forks source link

Add support for scissored rendering #247

Closed 17cupsofcoffee closed 3 years ago

17cupsofcoffee commented 3 years ago

Summary: Tetra should support GL's scissor functionality, much like how Love2D has love.graphics.setScissor.

This allows for rendering to be limited to a certain rectangle of the screen, discarding anything drawn outside those bounds.

The main things I'd need to take into account when implementing this are:

Why is this needed? This can be useful for UI rendering (e.g. so you can discard text that overflows out of a window). For more complex stuff I think you might have to use a stencil buffer, but that's complicated so I don't want to do it unless there's a need for it :p