mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Use correct height for y correction in set/getScissor (bug #234)
This commit is contained in:
@@ -372,6 +372,16 @@ namespace opengl
|
||||
strategy->deleteFBO(fbo, depthbuffer, img);
|
||||
}
|
||||
|
||||
int Framebuffer::getWidth()
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
int Framebuffer::getHeight()
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
} // opengl
|
||||
} // graphics
|
||||
} // love
|
||||
|
||||
@@ -41,6 +41,9 @@ namespace opengl
|
||||
void setWrap(const Image::Wrap &w);
|
||||
Image::Wrap getWrap() const;
|
||||
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
|
||||
bool loadVolatile();
|
||||
void unloadVolatile();
|
||||
|
||||
|
||||
@@ -365,6 +365,13 @@ namespace opengl
|
||||
return currentMode.height;
|
||||
}
|
||||
|
||||
int Graphics::getRenderHeight()
|
||||
{
|
||||
if (Framebuffer::current)
|
||||
return Framebuffer::current->getHeight();
|
||||
return currentMode.height;
|
||||
}
|
||||
|
||||
bool Graphics::isCreated()
|
||||
{
|
||||
return (currentMode.width > 0) || (currentMode.height > 0);
|
||||
@@ -409,7 +416,7 @@ namespace opengl
|
||||
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.
|
||||
glScissor(x, getRenderHeight() - (y + height), width, height); // Compensates for the fact that our y-coordinate is reverse of OpenGLs.
|
||||
}
|
||||
|
||||
void Graphics::setScissor()
|
||||
@@ -426,7 +433,7 @@ namespace opengl
|
||||
glGetIntegerv(GL_SCISSOR_BOX, scissor);
|
||||
|
||||
lua_pushnumber(L, scissor[0]);
|
||||
lua_pushnumber(L, getHeight() - (scissor[1] + scissor[3])); // Compensates for the fact that our y-coordinate is reverse of OpenGLs.
|
||||
lua_pushnumber(L, getRenderHeight() - (scissor[1] + scissor[3])); // Compensates for the fact that our y-coordinate is reverse of OpenGLs.
|
||||
lua_pushnumber(L, scissor[2]);
|
||||
lua_pushnumber(L, scissor[3]);
|
||||
|
||||
|
||||
@@ -118,6 +118,8 @@ namespace opengl
|
||||
GLint matrixLimit;
|
||||
GLint userMatrices;
|
||||
|
||||
int getRenderHeight();
|
||||
|
||||
public:
|
||||
|
||||
Graphics();
|
||||
|
||||
Reference in New Issue
Block a user