|
|
@ -1067,6 +1067,7 @@ typedef struct rlglData { |
|
|
|
Matrix stack[RL_MAX_MATRIX_STACK_SIZE];// Matrix stack for push/pop |
|
|
|
int stackCounter; // Matrix stack counter |
|
|
|
|
|
|
|
unsigned int currentTextureId; // Current texture id to be used on glBegin |
|
|
|
unsigned int defaultTextureId; // Default texture used on shapes/poly drawing (required by shader) |
|
|
|
unsigned int activeTextureId[RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS]; // Active texture ids to be enabled on batch drawing (0 active by default) |
|
|
|
unsigned int defaultVShaderId; // Default vertex shader id (used by default shader program) |
|
|
@ -1485,8 +1486,8 @@ void rlBegin(int mode) |
|
|
|
if (RLGL.currentBatch->drawCounter >= RL_DEFAULT_BATCH_DRAWCALLS) rlDrawRenderBatch(RLGL.currentBatch); |
|
|
|
|
|
|
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode; |
|
|
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0; |
|
|
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.defaultTextureId; |
|
|
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.currentTextureId; |
|
|
|
RLGL.State.currentTextureId = RLGL.State.defaultTextureId; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1651,6 +1652,7 @@ void rlSetTexture(unsigned int id) |
|
|
|
{ |
|
|
|
rlDrawRenderBatch(RLGL.currentBatch); |
|
|
|
} |
|
|
|
RLGL.State.currentTextureId = RLGL.State.defaultTextureId; |
|
|
|
#endif |
|
|
|
} |
|
|
|
else |
|
|
@ -1658,6 +1660,7 @@ void rlSetTexture(unsigned int id) |
|
|
|
#if defined(GRAPHICS_API_OPENGL_11) |
|
|
|
rlEnableTexture(id); |
|
|
|
#else |
|
|
|
RLGL.State.currentTextureId = id; |
|
|
|
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId != id) |
|
|
|
{ |
|
|
|
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0) |
|
|
@ -1676,6 +1679,9 @@ void rlSetTexture(unsigned int id) |
|
|
|
RLGL.State.vertexCounter += RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment; |
|
|
|
|
|
|
|
RLGL.currentBatch->drawCounter++; |
|
|
|
|
|
|
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 2].mode; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -2257,6 +2263,7 @@ void rlglInit(int width, int height) |
|
|
|
// Init default white texture |
|
|
|
unsigned char pixels[4] = { 255, 255, 255, 255 }; // 1 pixel RGBA (4 bytes) |
|
|
|
RLGL.State.defaultTextureId = rlLoadTexture(pixels, 1, 1, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); |
|
|
|
RLGL.State.currentTextureId = RLGL.State.defaultTextureId; |
|
|
|
|
|
|
|
if (RLGL.State.defaultTextureId != 0) TRACELOG(RL_LOG_INFO, "TEXTURE: [ID %i] Default texture loaded successfully", RLGL.State.defaultTextureId); |
|
|
|
else TRACELOG(RL_LOG_WARNING, "TEXTURE: Failed to load default texture"); |
|
|
|