OpenGL rendering is done by reimplementing QGraphicsScene's drawBackground() function. I also add two QGraphicsRectItem in the QGraphicsScene, one embeded a dialog with four buttons in it; another is a yellow Solid circle.
when the opengl codes are as follows included in drawBackground() of QGraphicsScene,
Qt Code:
  1. MTList=glGenLists(1);
  2.  
  3. glEnableClientState(GL_VERTEX_ARRAY);
  4. Vertex_iterator vi = model.vertices_begin();
  5. glVertexPointer(3, GL_DOUBLE, sizeof(Vertex), &(vi->point()[0]));
  6.  
  7. glDisable(GL_LIGHTING);
  8. glNewList(MTList, GL_COMPILE);
  9. glColor3f(1.0,0.0,1.0);
  10.  
  11. //glLineWidth(10.0);
  12. //glDisable(GL_CULL_FACE);
  13. //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  14.  
  15. glDrawElements(GL_POINTS, 3*model.size_of_facets(), GL_UNSIGNED_INT, &modelfaces[0]);
  16. glEndList();
  17.  
  18. glDisableClientState(GL_VERTEX_ARRAY);
To copy to clipboard, switch view to plain text mode 

at this time, the two items in QGraphicsScene display as expected:
1.jpg

However, when I uncomment //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE):
Qt Code:
  1. glColor3f(1.0,0.0,1.0);
  2.  
  3. //glLineWidth(10.0);
  4. //glDisable(GL_CULL_FACE);
  5. glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  6.  
  7. glDrawElements(GL_POINTS, 3*model.size_of_facets(), GL_UNSIGNED_INT, &modelfaces[0]);
To copy to clipboard, switch view to plain text mode 

(I know I should also change GL_TRIAGNLES, however the result is the same.) then the two items as distorted like two slashes:
2.jpg

Why this weird display occur ?

Thanks a lot