title: Performance Issue while using QGLWidget with Qt5
body: <p>I'm trying to develop an application which will be used for the visualization of 3D objects and its simulations. In this I have to draw 'n' number of objects (may be a triangle, rectangle or some other non-convex polygons) with individual color shades.For this I'm using QGLWidget in Qt5 (OS - Windows 7/8/10).</p>
  
  <p><strong>structure used for populating objects information:</strong></p>
  
  <pre><code>typedef struct {
    QList&lt;float&gt; r,g,b;
    QList&lt;double&gt; x,y,z;
  }objectData;
  </code></pre>
  
  <p>The number of objects and their corresponding coordinate values will be read from a file.</p>
  
  <p><strong>paintGL function:</strong></p>
  
  <pre><code>void paintGL() {
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      gluPerspective(25, GLWidget::width()/(float)GLWidget::height(), 0.1, 100);
      glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      gluLookAt(0,0,5,   0,0,0,   0,1,0);
      glRotatef(140, 0.0, 0.0, 1.0);
      glRotatef(95, 0.0, 1.0, 0.0);
      glRotatef(50, 1.0, 0.0, 0.0);
      glTranslated(-1.0, 0.0, -0.6);
      drawObjects(objData, 1000)
  }
  </code></pre>
  
  <p><strong>Drawing of Objects Function:</strong></p>
  
  <pre><code>void drawObjects(objectData objData,int objCnt) {
      glPushMatrix();
      glBegin(GL_POLYGON);
      for(int i = 0; i &lt; objCnt; i++) {
          glColor3f(objData.r[i],objData.g[i],objData.b[i] );
          glVertex3d(objData.x[i],objData.y[i],objData.z[i]);
      }
      glEnd();
      glFlush();
      glPopMatrix();
  }
  </code></pre>
  
  <p><strong>Issue:</strong> 
  Now, when the number of objects to be drawn exceeds a certain maximum value (for example say n = 5000), the application speed gradually decreases. I'm unable to use QThread since it already inherits QGLWidget.</p>
  
  <p>Please suggest how to improve the performance of the application when number of objects count is higher. I don't know where I'm doing mistake.</p>
  
  <p><strong>Screenshot of that sample:</strong></p>
  
  <p>Sample image which contains number of objects in mesh view</p>
  
  <p><img src="https://i.stack.imgur.com/mLAp0.png" alt=""></p>