title: How to render large number of similar objects?
body: <p>I have large number of objects (at least 10 000 particles) like triangles, squares, circles or spheres. Actually now I have one object which I render many times. It's looks like this:</p>
  
  <pre><code>for (int i=0; i&lt;totalParticleCount; i++) {
      drawObject-&gt;pos = hState[i].pos;
      drawObject-&gt;draw(vp);
  }
  </code></pre>
  
  <p>Draw function for my Circle object looks like this where variable "vp" is product of projection matrix on view matrix:</p>
  
  <pre><code>void Circle::draw(const glm::mat4 &amp;vp) {
      glUseProgram(programId);
      glUniformMatrix4fv(matrixId, 1, GL_FALSE, &amp;(vp * getModelMatrix(pos, scale))[0][0]);
  
      glEnableVertexAttribArray(0);
      glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
      glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
  
      glDrawArrays(GL_TRIANGLE_FAN, 0, vertexNumber);
      glDisableVertexAttribArray(0);
  }
  </code></pre>
  
  <p>I found that my process of rendering too slow. How can I increase performance of rendering? How can I efficiently use opengl for rendering similar objects?</p>