aboutsummaryrefslogtreecommitdiff
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2016-03-17 13:51:48 +0100
committerRay <raysan5@gmail.com>2016-03-17 13:51:48 +0100
commite2ba22ec596757d62f8b22cf8b722d68040f23d3 (patch)
tree28b9e0ddfe60534b167dd659e27c4fa10288d329 /src/rlgl.c
parent49df957058b2f602c7e6873fec0007fcd7a4dc4c (diff)
downloadraylib-e2ba22ec596757d62f8b22cf8b722d68040f23d3.tar.gz
raylib-e2ba22ec596757d62f8b22cf8b722d68040f23d3.zip
Improved 2D-3D drawing
Depth test disabled for 2D and only used on 3D; consequently LINES vs TRIANGLES vs QUADS buffers drawing order maters... but blending also works ok.
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index d9761732..f9722eda 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -780,6 +780,18 @@ void rlDisableTexture(void)
#endif
}
+// Enable depth test
+void rlEnableDepthTest(void)
+{
+ glEnable(GL_DEPTH_TEST);
+}
+
+// Disable depth test
+void rlDisableDepthTest(void)
+{
+ glDisable(GL_DEPTH_TEST);
+}
+
// Unload texture from GPU memory
void rlDeleteTextures(unsigned int id)
{
@@ -1579,7 +1591,7 @@ void rlglInitGraphics(int offsetX, int offsetY, int width, int height)
//glClearDepth(1.0f); // Clear depth buffer (default)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear used buffers, depth buffer is used for 3D
- glEnable(GL_DEPTH_TEST); // Enables depth testing (required for 3D)
+ glDisable(GL_DEPTH_TEST); // Disable depth testing for 2D (only used for 3D)
glDepthFunc(GL_LEQUAL); // Type of depth testing to apply
glEnable(GL_BLEND); // Enable color blending (required to work with transparencies)