void QMyGraphicsView::drawBackground( QPainter * painter, const QRectF & rect ){ /* этот код рисует */ glColor3f(0.6,0.4,0.0); glBegin(GL_TRIANGLES); glVertex2f(-0.5, -0.5); glVertex2f( 0.5, -0.5); glVertex2f( 0.0, 0.5); glEnd();/* а этот - нет )*/ painter->fillRect(rect,QBrush(QColor(Qt::yellow)));}
void QMyGraphicsView::drawBackground( QPainter * painter, const QRectF & rect ){ painter->fillRect(rect,QBrush(QColor(Qt::yellow))); glColor3f(0.6,0.4,0.0); glBegin(GL_TRIANGLES); glVertex2f(-0.5, -0.5); glVertex2f( 0.5, -0.5); glVertex2f( 0.0, 0.5); glEnd();}
void QPainter::beginNativePainting ()void QPainter::endNativePainting ()
void QMyGraphicsView::drawBackground( QPainter * painter, const QRectF & rect ){ GLuint glErr = glGetError(); char* gluErrStr = (char*)gluErrorString(glErr); painter->beginNativePainting(); glColor3f(0.6,0.4,0.0); glBegin(GL_TRIANGLES); glVertex2f(-0.5, -0.5); glVertex2f( 0.5, -0.5); glVertex2f( 0.0, 0.5); glEnd(); painter->endNativePainting(); painter->fillRect(rect,QBrush(QColor(Qt::yellow)));}
glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glColor3f(0.6,0.4,0.0); glBegin(GL_TRIANGLES); glVertex2f(-0.5, -0.5); glVertex2f( 0.5, -0.5); glVertex2f( 0.0, 0.5); glEnd();
painter->fillRect(rect,QBrush(QColor(Qt::yellow)));
glEnable(GL_CULL_FACE);glCullFace(GL_BACK);