Fixed love.graphics.setScissor when love.graphics.setCanvas is called directly after a setScissor call

This commit is contained in:
Alex Szpakowski
2013-06-07 03:31:30 -03:00
parent 1482b13363
commit c0998cd996
5 changed files with 90 additions and 13 deletions
+40
View File
@@ -48,6 +48,21 @@ class OpenGL
{
public:
// A rectangle representing an OpenGL viewport or a scissor box.
struct Viewport
{
int x, y;
int w, h;
Viewport()
: x(0), y(0), w(0), h(0)
{}
Viewport(int _x, int _y, int _w, int _h)
: x(_x), y(_y), w(_w), h(_h)
{}
};
OpenGL();
/**
@@ -83,6 +98,28 @@ public:
**/
Color getClearColor() const;
/**
* Sets the OpenGL rendering viewport to the specified rectangle.
* The y-coordinate starts at the top.
**/
void setViewport(const Viewport &v);
/**
* Gets the current OpenGL rendering viewport rectangle.
**/
Viewport getViewport() const;
/**
* Sets the scissor box to the specified rectangle.
* The y-coordinate starts at the top and is flipped internally.
**/
void setScissor(const Viewport &v);
/**
* Gets the current scissor box (regardless of whether scissoring is enabled.)
**/
Viewport getScissor() const;
/**
* Helper for setting the active texture unit.
*
@@ -153,6 +190,9 @@ private:
// Currently active texture unit.
int curTextureUnit;
Viewport viewport;
Viewport scissor;
} state;
}; // OpenGL