17cupsofcoffee / tetra

🎮 A simple 2D game framework written in Rust

Home Page:https://tetra.seventeencups.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for scissored rendering

17cupsofcoffee opened this issue · comments

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:

  • How it interacts with viewport size changes (does it have to be reapplied?)
  • How it interacts with canvases (the co-ordinate system is different for a canvas due to it being stored upside down internally)

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