Browse Source

Improved BeginScissorMode()

Now rectangle coordinates refer to upper-left corner instead of bottom-left
Ray 6 years ago
parent
commit
af33e3848e
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/rlgl.h

+ 2 - 1
src/rlgl.h

@@ -3283,12 +3283,13 @@ void EndBlendMode(void)
 }
 
 // Begin scissor mode (define screen area for following drawing)
+// NOTE: Scissor rec refers to bottom-left corner, we change it to upper-left
 void BeginScissorMode(int x, int y, int width, int height)
 {
     rlglDraw();             // Force drawing elements
     
     glEnable(GL_SCISSOR_TEST);
-    glScissor(x, y, width, height);
+    glScissor(x, GetScreenHeight() - (y + height), width, height);
     
     rlClearScreenBuffers(); // Clear current scissor area
 }