Added scissor functionality

To draw only in defined area of the screen
ADDED: BeginScissorMode(), EndScissorMode()
This commit is contained in:
Ray 2018-12-15 23:30:55 +01:00
parent cbbd67ab5a
commit 4008a075a8
2 changed files with 22 additions and 0 deletions

View File

@ -1158,6 +1158,7 @@ RLAPI void MeshTangents(Mesh *mesh);
RLAPI void MeshBinormals(Mesh *mesh); // Compute mesh binormals
// Mesh generation functions
RLAPI Mesh GenMeshPoly(int sides, float radius); // Generate polygonal mesh
RLAPI Mesh GenMeshPlane(float width, float length, int resX, int resZ); // Generate plane mesh (with subdivisions)
RLAPI Mesh GenMeshCube(float width, float height, float length); // Generate cuboid mesh
RLAPI Mesh GenMeshSphere(float radius, int rings, int slices); // Generate sphere mesh (standard sphere)
@ -1228,6 +1229,8 @@ RLAPI void BeginShaderMode(Shader shader); // Beg
RLAPI void EndShaderMode(void); // End custom shader drawing (use default shader)
RLAPI void BeginBlendMode(int mode); // Begin blending mode (alpha, additive, multiplied)
RLAPI void EndBlendMode(void); // End blending mode (reset to default: alpha blending)
RLAPI void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
RLAPI void EndScissorMode(void); // End scissor mode
// VR control functions
RLAPI VrDeviceInfo GetVrDeviceInfo(int vrDeviceType); // Get VR device information for some standard devices

View File

@ -3313,6 +3313,25 @@ void EndBlendMode(void)
BeginBlendMode(BLEND_ALPHA);
}
// Begin scissor mode (define screen area for following drawing)
void BeginScissorMode(int x, int y, int width, int height)
{
rlglDraw(); // Force drawing elements
glEnable(GL_SCISSOR_TEST);
glScissor(x, y, width, height);
rlClearScreenBuffers(); // Clear current scissor area
}
// End scissor mode
void EndScissorMode(void)
{
rlglDraw(); // Force drawing elements
glDisable(GL_SCISSOR_TEST);
}
#if defined(SUPPORT_VR_SIMULATOR)
// Get VR device information for some standard devices
VrDeviceInfo GetVrDeviceInfo(int vrDeviceType)