aboutsummaryrefslogtreecommitdiff
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2014-07-23 01:25:33 +0200
committerraysan5 <raysan5@gmail.com>2014-07-23 01:25:33 +0200
commitecb3c47704ccaa349ee4824b019181d700919582 (patch)
treeef3059010117ac78c1548494903a9c60c71b149c /src/rlgl.c
parent0b03431c95c3c348aa686c1a3df68a51bd7761a6 (diff)
downloadraylib-ecb3c47704ccaa349ee4824b019181d700919582.tar.gz
raylib-ecb3c47704ccaa349ee4824b019181d700919582.zip
Corrected bug with drawing order
We have three vertex buffers: lines, triangles and quads for textures. Drawing in a desired order could become a nighmare... noww it seems it works prety well...
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index c181c7d6..75978e11 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -825,7 +825,17 @@ void rlglDraw()
glUniformMatrix4fv(modelviewMatrixLoc, 1, false, GetMatrixVector(modelview));
glUniform1i(textureLoc, 0);
- // NOTE: We draw in this order: textured quads, triangles shapes, lines
+ // NOTE: We draw in this order: triangle shapes, textured quads and lines
+
+ if (triangles.vCounter > 0)
+ {
+ glBindTexture(GL_TEXTURE_2D, whiteTexture);
+
+ glBindVertexArray(vaoTriangles);
+ glDrawArrays(GL_TRIANGLES, 0, triangles.vCounter);
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+ }
if (quads.vCounter > 0)
{
@@ -855,16 +865,6 @@ void rlglDraw()
glBindTexture(GL_TEXTURE_2D, 0); // Unbind textures
}
- if (triangles.vCounter > 0)
- {
- glBindTexture(GL_TEXTURE_2D, whiteTexture);
-
- glBindVertexArray(vaoTriangles);
- glDrawArrays(GL_TRIANGLES, 0, triangles.vCounter);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- }
-
if (lines.vCounter > 0)
{
glBindTexture(GL_TEXTURE_2D, whiteTexture);