diff --git a/src/multimedia/qgraphicsvideoitem.cpp b/src/multimedia/qgraphicsvideoitem.cpp index c7d0516..cef60d0 100644 --- a/src/multimedia/qgraphicsvideoitem.cpp +++ b/src/multimedia/qgraphicsvideoitem.cpp @@ -55,6 +55,8 @@ #include #endif +#define PRINT_MARK qDebug() << __FILE__ << __PRETTY_FUNCTION__ << __LINE__ + QT_BEGIN_NAMESPACE class QGraphicsVideoItemPrivate @@ -386,7 +388,42 @@ void QGraphicsVideoItem::paint( Q_UNUSED(option); Q_UNUSED(widget); +#if 1 + static int count = 0; + static QGLContext * glContext = NULL; + static GLuint pixmapTexture = 0; + qDebug() << "count_lib:" << count << "glContext: " << (void*) QGLContext::currentContext(); + if(count++ >5) { + if (!glContext) { // I'm not sure when GLContext could setup. + glContext = const_cast(QGLContext::currentContext()); + } + + painter->beginNativePainting(); + glEnable(GL_TEXTURE_2D); + glLoadIdentity(); + if(!glIsTexture(pixmapTexture)) { + // pixmapTexture = glContext->bindTexture(QImage(QString("./side5.png")), GL_TEXTURE_2D); + PRINT_MARK; qDebug() << "###########################################"; + pixmapTexture = glContext->bindTexture(QPixmap(QString("/home/halley/qt/player-qt-mobility/side6.png")), GL_TEXTURE_2D); + PRINT_MARK; qDebug() << "###########################################"; + } + glBindTexture(GL_TEXTURE_2D, pixmapTexture); + + glBegin(GL_TRIANGLES); + glColor3f( 0.8, 0.8, 1.0); + glVertex3f(0+5, glContext->device()->height()/4, 0.0); + glTexCoord2f(0.0f, 0.0f); + glVertex3f(0+5, glContext->device()->height()*3/4, 0.0); + glTexCoord2f(1.0f, 0.0f); + glVertex3f(glContext->device()->width()/2, glContext->device()->height()*3/4, 0.0); + glTexCoord2f(1.0f, 1.0f); + glEnd(); + glColor3f( 1.0, 1.0, 1.0); + painter->endNativePainting(); + } + // return; // ignor other painting +#endif if (d->surface && d->surface->isActive()) { d->surface->paint(painter, d->boundingRect, d->sourceRect); d->surface->setReady(true);