mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-27 21:48:31 +00:00
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...
This commit is contained in:
22
src/rlgl.c
22
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);
|
||||
|
Reference in New Issue
Block a user