From 1d91a460088a4c4e33dfa94c6d2bd0bf859e9986 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 13 Sep 2017 22:23:24 +0200 Subject: Corrected out-of-bounds array issue --- src/rlgl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/rlgl.c') diff --git a/src/rlgl.c b/src/rlgl.c index 373dada9..13f084f3 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(); -- cgit v1.2.3 From ff9b486ebe61d84d14add801d67c3bbdaca111e2 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 22 Sep 2017 13:53:29 +0200 Subject: Removed matrix resetting... to emulate OpenGL funcionality --- src/rlgl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/rlgl.c') diff --git a/src/rlgl.c b/src/rlgl.c index 13f084f3..48733f79 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -418,7 +418,6 @@ void rlPushMatrix(void) } stack[stackCounter] = *currentMatrix; - rlLoadIdentity(); stackCounter++; if (currentMatrixMode == RL_MODELVIEW) useTempBuffer = true; -- cgit v1.2.3 From 2068037417f44c2d86bd15e4ce6631e2faf662de Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 26 Sep 2017 00:51:26 +0200 Subject: Code tweak --- src/rlgl.c | 1 - src/textures.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/rlgl.c') diff --git a/src/rlgl.c b/src/rlgl.c index 48733f79..c336ac4c 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -2212,7 +2212,6 @@ void *rlReadTexturePixels(Texture2D texture) // 2 - Create an fbo, activate it, render quad with texture, glReadPixels() #define GET_TEXTURE_FBO_OPTION_1 // It works - #if defined(GET_TEXTURE_FBO_OPTION_1) glBindFramebuffer(GL_FRAMEBUFFER, fbo.id); glBindTexture(GL_TEXTURE_2D, 0); diff --git a/src/textures.c b/src/textures.c index b6c90ad7..b9fc5c19 100644 --- a/src/textures.c +++ b/src/textures.c @@ -1068,7 +1068,7 @@ Image ImageTextEx(SpriteFont font, const char *text, float fontSize, int spacing Vector2 imSize = MeasureTextEx(font, text, font.baseSize, spacing); - // NOTE: GetTextureData() not available in OpenGL ES + // NOTE: glGetTexImage() not available in OpenGL ES Image imFont = GetTextureData(font.texture); ImageFormat(&imFont, UNCOMPRESSED_R8G8B8A8); // Convert to 32 bit for color tint -- cgit v1.2.3