ppy/osu-framework

Scissor and Viewport usage order matters with `GLRenderer`

smoogipoo opened this issue · 0 comments

These two functions should be independent of one another, however they are currently tied to each other in a very peculiar way because GLRenderer calculates the scissor's y-position based on the current viewport:

protected override void SetScissorImplementation(RectangleI scissor) => GL.Scissor(scissor.X, Viewport.Height - scissor.Bottom, scissor.Width, scissor.Height);

This means that the following order of operations leads to the wrong result:

PushViewport()
PushScissor()

PopScissor()
PopViewport()

Where the order of operations that leads to a correct result is:

PushViewport()
PushScissor()

PopViewport()
PopScissor()