|
264 | 264 | #define RL_TEXTURE 0x1702 // GL_TEXTURE |
265 | 265 |
|
266 | 266 | // Primitive assembly draw modes |
| 267 | +#define RL_POINTS 0x0000 // GL_POINTS |
267 | 268 | #define RL_LINES 0x0001 // GL_LINES |
268 | 269 | #define RL_TRIANGLES 0x0004 // GL_TRIANGLES |
269 | 270 | #define RL_QUADS 0x0007 // GL_QUADS |
@@ -1455,6 +1456,7 @@ void rlBegin(int mode) |
1455 | 1456 | { |
1456 | 1457 | switch (mode) |
1457 | 1458 | { |
| 1459 | + case RL_POINTS: glBegin(GL_POINTS); break; |
1458 | 1460 | case RL_LINES: glBegin(GL_LINES); break; |
1459 | 1461 | case RL_TRIANGLES: glBegin(GL_TRIANGLES); break; |
1460 | 1462 | case RL_QUADS: glBegin(GL_QUADS); break; |
@@ -1487,7 +1489,8 @@ void rlBegin(int mode) |
1487 | 1489 | // It implies adding some extra alignment vertex at the end of the draw, |
1488 | 1490 | // those vertex are not processed but they are considered as an additional offset |
1489 | 1491 | // for the next set of vertex to be drawn |
1490 | | - if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); |
| 1492 | + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_POINTS) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount & 3)) & 3; |
| 1493 | + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); |
1491 | 1494 | else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); |
1492 | 1495 | else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; |
1493 | 1496 |
|
@@ -1536,7 +1539,15 @@ void rlVertex3f(float x, float y, float z) |
1536 | 1539 | // Checking current draw.mode when a new vertex is required and finish the batch only if the draw.mode draw.vertexCount is %2, %3 or %4 |
1537 | 1540 | if (RLGL.State.vertexCounter > (RLGL.currentBatch->vertexBuffer[RLGL.currentBatch->currentBuffer].elementCount*4 - 4)) |
1538 | 1541 | { |
1539 | | - if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) && |
| 1542 | + if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_POINTS) && |
| 1543 | + (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount != 0)) |
| 1544 | + { |
| 1545 | + // Reached the maximum number of vertices for RL_POINTS drawing |
| 1546 | + // Launch a draw call but keep current state for next vertices comming |
| 1547 | + // NOTE: Adding +1 vertex to the check for some safety |
| 1548 | + rlCheckRenderBatchLimit(1 + 1); |
| 1549 | + } |
| 1550 | + else if ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) && |
1540 | 1551 | (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%2 == 0)) |
1541 | 1552 | { |
1542 | 1553 | // Reached the maximum number of vertices for RL_LINES drawing |
@@ -1685,7 +1696,8 @@ void rlSetTexture(unsigned int id) |
1685 | 1696 | // It implies adding some extra alignment vertex at the end of the draw, |
1686 | 1697 | // those vertex are not processed but they are considered as an additional offset |
1687 | 1698 | // for the next set of vertex to be drawn |
1688 | | - if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); |
| 1699 | + if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_POINTS) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount & 3)) & 3; |
| 1700 | + else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_LINES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount : RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4); |
1689 | 1701 | else if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode == RL_TRIANGLES) RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = ((RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount < 4)? 1 : (4 - (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount%4))); |
1690 | 1702 | else RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexAlignment = 0; |
1691 | 1703 |
|
@@ -3131,7 +3143,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch) |
3131 | 3143 | // Bind current draw call texture, activated as GL_TEXTURE0 and bound to sampler2D texture0 by default |
3132 | 3144 | glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId); |
3133 | 3145 |
|
3134 | | - if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount); |
| 3146 | + if ((batch->draws[i].mode == RL_POINTS) || (batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount); |
3135 | 3147 | else |
3136 | 3148 | { |
3137 | 3149 | #if defined(GRAPHICS_API_OPENGL_33) |
|
0 commit comments