From 5baab54f93f0b034a8918d79c8882c077e4b140c Mon Sep 17 00:00:00 2001 From: Shiqing Date: Sat, 15 Jun 2019 13:46:48 +0800 Subject: [PATCH] Fix vertex padding not zeroed for quads, close #891 --- src/rlgl.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rlgl.h b/src/rlgl.h index 10d21fcc..b2f1d0bc 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1072,6 +1072,8 @@ void rlBegin(int mode) if (draws[drawsCounter - 1].mode == RL_LINES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? draws[drawsCounter - 1].vertexCount : draws[drawsCounter - 1].vertexCount%4); else if (draws[drawsCounter - 1].mode == RL_TRIANGLES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? 1 : (4 - (draws[drawsCounter - 1].vertexCount%4))); + else draws[drawsCounter - 1].vertexAlignment = 0; + if (rlCheckBufferLimit(draws[drawsCounter - 1].vertexAlignment)) rlglDraw(); else { @@ -1243,6 +1245,8 @@ void rlEnableTexture(unsigned int id) if (draws[drawsCounter - 1].mode == RL_LINES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? draws[drawsCounter - 1].vertexCount : draws[drawsCounter - 1].vertexCount%4); else if (draws[drawsCounter - 1].mode == RL_TRIANGLES) draws[drawsCounter - 1].vertexAlignment = ((draws[drawsCounter - 1].vertexCount < 4)? 1 : (4 - (draws[drawsCounter - 1].vertexCount%4))); + else draws[drawsCounter - 1].vertexAlignment = 0; + if (rlCheckBufferLimit(draws[drawsCounter - 1].vertexAlignment)) rlglDraw(); else { @@ -4611,4 +4615,4 @@ int GetPixelDataSize(int width, int height, int format) } #endif // RLGL_STANDALONE -#endif // RLGL_IMPLEMENTATION \ No newline at end of file +#endif // RLGL_IMPLEMENTATION