Issues

Issue #234 resolved

love.graphics.setScissor doesn't work properly inside a framebuffer

Aleksi Juvani
created an issue

The y-coordinate of setScissor is always offset by the difference of the screen's height and the framebuffer's height.

I took a look at the source, and it looks like that you are flipping the y-coordinate in the Graphics::setScissor -method.

{{{

!c++

void Graphics::setScissor(int x, int y, int width, int height) { glEnable(GL_SCISSOR_TEST); glScissor(x, getHeight() - (y + height), width, height); // Compensates for the fact that our y-coordinate is reverse of OpenGLs. } }}}

Because binding to a framebuffer changes the viewport, this compensation will now return an incorrect value - causing the scissor to be offset.

This could be fixed by using the current viewport's height instead of the screen's height for the compensation.

I attached a love-file that draws two cubes. The first one is cut normally (doesn't work, the whole cube is invisible) and the second one is cut using a workaround (works fine, half of the cube is drawn).

Comments (10)

  1. Log in to comment