title: OpenGl rotating triangles have some bad effects
body: <p>I wrote a code to draw 10 yellow triangles on the screen and rotate them to animate like this I will add 2 frames below:<img src="https://i.stack.imgur.com/n9ive.png" alt="frame 1">  <img src="https://i.stack.imgur.com/aL6aB.png" alt="frame 2"></p>
  
  <p>All this is very nice, but when I add number of rectangles to be about 800 then I see this:</p>
  
  <p><img src="https://i.stack.imgur.com/Nv9TY.png" alt="open gl cannot handle 800 triangles 1">. </p>
  
  <p>In the case when I have 500 triangles I see the following problems: </p>
  
  <p><img src="https://i.stack.imgur.com/AgbHA.png" alt="500 triangles problem 1"> <img src="https://i.stack.imgur.com/YuXnC.png" alt="500 triangles problem 2"> <img src="https://i.stack.imgur.com/QcFAt.png" alt="500 triangles problem 3"> <img src="https://i.stack.imgur.com/w4KYW.png" alt="500 triangles problem 4"></p>
  
  <p>As you can see I don't even have those colors. (I have only black and the yellow one.) Actually, you can see there any color, depending on the number of triangles. I think this is some OpenGL problem. I an new to OpenGL and I guess I misused something in OpenGL. Here is the code. It is in cocos2d-x (C++) but surely you can understand what is being done here:</p>
  
  <pre><code>Color4F color1e(239.0f / 255, 255.0f / 255, 138.0f / 255, 1);
  
  auto sunNode = DrawNode::create();
  sunNode-&gt;setContentSize(_size);
  
  int bansCount = 1000;
  Vec2 center(_size / 2);
  
  float angleStep = (2 * 3.1415926) / bansCount;
  
  auto rotated = [angleStep, center](float mult) {
  Vec2 vc(0, 0);
  vc.rotate(center, angleStep * mult);
  return vc - center;
  };
  
  for(int i = 0; i &lt; bansCount; i+=2) {
     sunNode-&gt;drawTriangle(
     Vec2(0,0), // vertex 1
      rotated(i), // vertex 2
      rotated(i + 1), // vertex 3
      color1e // color of vertices
  );
  }
  
  addChild(sunNode, 2); // add to sceen
  sunNode-&gt;setPosition(center); // position on center
  
  // infinitely rotate 
  sunNode-&gt;runAction(RepeatForever::create(RotateBy::create(0.05, 3.1415926 / 10)));
  </code></pre>
  
  <p>Code full is here, in case someone want to look at or experiment: <a href="https://github.com/jonyrock/Cocos2dxDrawingArtifacts" rel="nofollow noreferrer">https://github.com/jonyrock/Cocos2dxDrawingArtifacts</a></p>