Browse Source

REVIEWED: DrawLine3D() #1721

Increased batch limit check to compensate internal buffers alignment for lines drawing
Ray 4 years ago
parent
commit
06f16f199a
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/models.c

+ 5 - 2
src/models.c

@@ -131,7 +131,10 @@ static void InitGLTFBones(Model* model, const cgltf_data* data);
 // Draw a line in 3D world space
 // Draw a line in 3D world space
 void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
 void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
 {
 {
-    rlCheckRenderBatchLimit(2);
+    // WARNING: Be careful with internal buffer vertex alignment
+    // when using RL_LINES or RL_TRIANGLES, data is aligned to fit
+    // lines-triangles-quads in the same indexed buffers!!!
+    rlCheckRenderBatchLimit(4);
 
 
     rlBegin(RL_LINES);
     rlBegin(RL_LINES);
         rlColor4ub(color.r, color.g, color.b, color.a);
         rlColor4ub(color.r, color.g, color.b, color.a);
@@ -143,7 +146,7 @@ void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
 // Draw a point in 3D space, actually a small line
 // Draw a point in 3D space, actually a small line
 void DrawPoint3D(Vector3 position, Color color)
 void DrawPoint3D(Vector3 position, Color color)
 {
 {
-    rlCheckRenderBatchLimit(2);
+    rlCheckRenderBatchLimit(4);
 
 
     rlPushMatrix();
     rlPushMatrix();
         rlTranslatef(position.x, position.y, position.z);
         rlTranslatef(position.x, position.y, position.z);