From 68a02e567d5fea42d1593e7932a0e052cf244d52 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 11 Jun 2016 12:41:03 +0200 Subject: [PATCH] Avoid external variable whiteTexture To get it, use GetDefaultTexture() --- src/models.c | 4 ++-- src/rlgl.c | 3 +-- src/shapes.c | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/models.c b/src/models.c index 8d9219e3..8deabcb0 100644 --- a/src/models.c +++ b/src/models.c @@ -50,7 +50,7 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -extern unsigned int whiteTexture; +// ... //---------------------------------------------------------------------------------- // Module specific Functions Declaration @@ -811,7 +811,7 @@ void UnloadMaterial(Material material) // Link a texture to a model void SetModelTexture(Model *model, Texture2D texture) { - if (texture.id <= 0) model->material.texDiffuse.id = whiteTexture; // Use default white texture + if (texture.id <= 0) model->material.texDiffuse = GetDefaultTexture(); // Use default white texture else model->material.texDiffuse = texture; } diff --git a/src/rlgl.c b/src/rlgl.c index 9a88a818..d4502595 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -228,8 +228,7 @@ static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays; static int blendMode = 0; // White texture useful for plain color polys (required by shader) -// NOTE: It's required in shapes and models modules! -unsigned int whiteTexture; +static unsigned int whiteTexture; //---------------------------------------------------------------------------------- // Module specific Functions Declaration diff --git a/src/shapes.c b/src/shapes.c index 7129ac17..3ccfd660 100644 --- a/src/shapes.c +++ b/src/shapes.c @@ -44,7 +44,7 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -extern unsigned int whiteTexture; +// ... //---------------------------------------------------------------------------------- // Module specific Functions Declaration @@ -137,7 +137,7 @@ void DrawCircleV(Vector2 center, float radius, Color color) } else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) { - rlEnableTexture(whiteTexture); // Default white texture + rlEnableTexture(GetDefaultTexture().id); // Default white texture rlBegin(RL_QUADS); for (int i = 0; i < 360; i += 20) @@ -220,7 +220,7 @@ void DrawRectangleV(Vector2 position, Vector2 size, Color color) } else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20)) { - rlEnableTexture(whiteTexture); // Default white texture + rlEnableTexture(GetDefaultTexture().id); // Default white texture rlBegin(RL_QUADS); rlColor4ub(color.r, color.g, color.b, color.a);