Strange problem about OpenGL drawing in a QGraphicsView.
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,
Vertex_iterator vi = model.vertices_begin();
glVertexPointer(3, GL_DOUBLE, sizeof(Vertex), &(vi->point()));
glDrawElements(GL_POINTS, 3*model.size_of_facets(), GL_UNSIGNED_INT, &modelfaces); glEndList();
at this time, the two items in QGraphicsScene display as expected:
However, when I uncomment //glPolygonMode(GL_FRONT_AND_BACK, GL_LINE):
glDrawElements(GL_POINTS, 3*model.size_of_facets(), GL_UNSIGNED_INT, &modelfaces);@
(I know I should also change GL_TRIAGNLES, however the result is the same.) then the two items as distorted like two slashes:
Why this weird display occur ?
Thanks a lot
I revised the line to : glPolygonMode(GL_BACK, GL_LINE); the problem still exists,
HHHOoooWWwwever, glPolygonMode(GL_FRONT, GL_LINE); sloved the problem and the two items come out to be as expected.