Pārlūkot izejas kodu

Avoid external variable whiteTexture

To get it, use GetDefaultTexture()
pull/129/merge
raysan5 pirms 8 gadiem
vecāks
revīzija
68a02e567d
3 mainītis faili ar 6 papildinājumiem un 7 dzēšanām
  1. +2
    -2
      src/models.c
  2. +1
    -2
      src/rlgl.c
  3. +3
    -3
      src/shapes.c

+ 2
- 2
src/models.c Parādīt failu

@ -50,7 +50,7 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Global Variables Definition // Global Variables Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
k">extern unsigned int whiteTexture; o">// ...
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration
@ -811,7 +811,7 @@ void UnloadMaterial(Material material)
// Link a texture to a model // Link a texture to a model
void SetModelTexture(Model *model, Texture2D texture) 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; else model->material.texDiffuse = texture;
} }

+ 1
- 2
src/rlgl.c Parādīt failu

@ -228,8 +228,7 @@ static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
static int blendMode = 0; static int blendMode = 0;
// White texture useful for plain color polys (required by shader) // White texture useful for plain color polys (required by shader)
// NOTE: It's required in shapes and models modules! static unsigned int whiteTexture;
unsigned int whiteTexture;
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // Module specific Functions Declaration

+ 3
- 3
src/shapes.c Parādīt failu

@ -44,7 +44,7 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Global Variables Definition // Global Variables Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
k">extern unsigned int whiteTexture; o">// ...
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module specific Functions Declaration // 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)) else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
{ {
rlEnableTexture(whiteTexture); // Default white texture rlEnableTexture(GetDefaultTexture().id); // Default white texture
rlBegin(RL_QUADS); rlBegin(RL_QUADS);
for (int i = 0; i < 360; i += 20) 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)) else if ((rlGetVersion() == OPENGL_33) || (rlGetVersion() == OPENGL_ES_20))
{ {
rlEnableTexture(whiteTexture); // Default white texture rlEnableTexture(GetDefaultTexture().id); // Default white texture
rlBegin(RL_QUADS); rlBegin(RL_QUADS);
rlColor4ub(color.r, color.g, color.b, color.a); rlColor4ub(color.r, color.g, color.b, color.a);

||||||
x
 
000:0
Notiek ielāde…
Atcelt
Saglabāt