{
painter->fillRect(0, 0, 128, 128, Qt::green);
painter->beginNativePainting();
// Set background clearing color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set drawing color to red, and draw rectangle at
// current position.
glColor3f(1.0f, 0.0f, 0.0f);
glRectf(128, 128, 200, 200);
//glFlush();
painter->endNativePainting();
}
void item::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
{
painter->fillRect(0, 0, 128, 128, Qt::green);
painter->beginNativePainting();
// Set background clearing color to blue
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT);
// Set drawing color to red, and draw rectangle at
// current position.
glColor3f(1.0f, 0.0f, 0.0f);
glRectf(128, 128, 200, 200);
//glFlush();
painter->endNativePainting();
}
To copy to clipboard, switch view to plain text mode
Bookmarks