[Qt-interest] How can I get my job done with QGLWidget?

fog public fogpub at gmail.com
Wed Jun 24 05:53:14 CEST 2009


Hi all, I am a newbee in QT development, high performace real-time graphic
data rendering is what I want to archieved. I did try QGLWidget,
It's very easy to use, now I was woundering if I can use a off-screen
framebuffer object to get faster 2D graphic rendering speed, I try to
declare a QGLFrameBufferObject pointer member in my class
which inheritances from QGLWidget and initialized it in  constructor just
like
QMyGLWidget::QMyGLWidget( QWidget *parent)
  :QGLWidget( QGLFormat( QGL::SampleBuffers),parent)
{
     this->showFullScreen();
     setAutoSwapBuffers(false);
     setAutoFillbackground(false);
     pFrameBuffer = NULL;
     makeCurrent();
     pFrameBuffer = new QGLFrameBufferObject(width(),height());
....
}
and rewrite the paintEvent(QPaintEvent *e) to get a shot.
void QMyGLWidget::paintEvent(QPaintEvent *e)
{
    QPainter painter(pFrameBuffer);
    //do some 2d painting
   painter.end();
   swapbuffers();
}
but I got nothing display on the screen, If I must call some functions to
force QGLWidget using framebuffer I declared,and swap it to show??Please
give me a advice thanks a lot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090624/fa84c404/attachment.html 


More information about the Qt-interest-old mailing list