Added some comments on latest change
This commit is contained in:
parent
27af359d1c
commit
da8a08006a
1 changed files with 6 additions and 2 deletions
|
@ -1459,7 +1459,9 @@ void rlBegin(int mode)
|
||||||
// NOTE: In all three cases, vertex are accumulated over default internal vertex buffer
|
// NOTE: In all three cases, vertex are accumulated over default internal vertex buffer
|
||||||
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode != mode)
|
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode != mode)
|
||||||
{
|
{
|
||||||
|
// Get current binded texture to preserve it between draw modes change (QUADS <--> TRIANGLES)
|
||||||
int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId;
|
int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId;
|
||||||
|
|
||||||
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0)
|
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0)
|
||||||
{
|
{
|
||||||
// Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4,
|
// Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4,
|
||||||
|
@ -1482,14 +1484,16 @@ void rlBegin(int mode)
|
||||||
|
|
||||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode;
|
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].vertexCount = 0;
|
||||||
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture;
|
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture; // Preserve active texture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish vertex providing
|
// Finish vertex providing
|
||||||
void rlEnd(void)
|
void rlEnd(void)
|
||||||
{
|
{
|
||||||
|
// Reset texture to default
|
||||||
rlSetTexture(RLGL.State.defaultTextureId);
|
rlSetTexture(RLGL.State.defaultTextureId);
|
||||||
|
|
||||||
// NOTE: Depth increment is dependant on rlOrtho(): z-near and z-far values,
|
// NOTE: Depth increment is dependant on rlOrtho(): z-near and z-far values,
|
||||||
// as well as depth buffer bit-depth (16bit or 24bit or 32bit)
|
// as well as depth buffer bit-depth (16bit or 24bit or 32bit)
|
||||||
// Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits)
|
// Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits)
|
||||||
|
@ -3057,7 +3061,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
|
||||||
|
|
||||||
for (int i = 0, vertexOffset = 0; i < batch->drawCounter; i++)
|
for (int i = 0, vertexOffset = 0; i < batch->drawCounter; i++)
|
||||||
{
|
{
|
||||||
// Bind current draw call texture, activated as GL_TEXTURE0 and Bound to sampler2D texture0 by default
|
// Bind current draw call texture, activated as GL_TEXTURE0 and bound to sampler2D texture0 by default
|
||||||
glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId);
|
glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId);
|
||||||
|
|
||||||
if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount);
|
if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue