From 1d91a460088a4c4e33dfa94c6d2bd0bf859e9986 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 13 Sep 2017 22:23:24 +0200 Subject: [PATCH] Corrected out-of-bounds array issue --- src/audio.c | 1 + src/rlgl.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/audio.c b/src/audio.c index 1b340377a..06af8ed45 100644 --- a/src/audio.c +++ b/src/audio.c @@ -69,6 +69,7 @@ #define SUPPORT_FILEFORMAT_WAV #define SUPPORT_FILEFORMAT_OGG #define SUPPORT_FILEFORMAT_XM +#define SUPPORT_FILEFORMAT_MOD //------------------------------------------------- #if defined(AUDIO_STANDALONE) diff --git a/src/rlgl.c b/src/rlgl.c index 373dada91..13f084f3c 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -814,6 +814,12 @@ void rlEnableTexture(unsigned int id) if (draws[drawsCounter - 1].textureId != id) { if (draws[drawsCounter - 1].vertexCount > 0) drawsCounter++; + + if (drawsCounter >= MAX_DRAWS_BY_TEXTURE) + { + rlglDraw(); + drawsCounter = 1; + } draws[drawsCounter - 1].textureId = id; draws[drawsCounter - 1].vertexCount = 0; @@ -2941,7 +2947,7 @@ void ToggleVrMode(void) // Reset viewport and default projection-modelview matrices rlViewport(0, 0, screenWidth, screenHeight); - projection = MatrixOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f); + projection = MatrixOrtho(0.0, screenWidth, screenHeight, 0.0, 0.0, 1.0); modelview = MatrixIdentity(); } else vrStereoRender = true; @@ -3043,7 +3049,7 @@ void EndVrDrawing(void) // Reset viewport and default projection-modelview matrices rlViewport(0, 0, screenWidth, screenHeight); - projection = MatrixOrtho(0, screenWidth, screenHeight, 0, 0.0f, 1.0f); + projection = MatrixOrtho(0.0, screenWidth, screenHeight, 0.0, 0.0, 1.0); modelview = MatrixIdentity(); rlDisableDepthTest();