[Qt-interest] Problem in creating empty QGLFrameBufferObject
Samuel Rødal
sroedal at trolltech.com
Thu Nov 5 12:45:24 CET 2009
trinathpujari wrote:
> I want to use QGLFrameBufferObject for writing texts into
> another LCD device.
> But when i am creating by entering the below
>
> makeCurrent();
> fbo = new QGLFramebufferObject(100, 100);
>
> and when i run the program some data from previous example
> program is seen.
> Can anybody tell how to create a empty QGLFramebufferObject so i
> can use it for the second LCD device.
>
> The example which i am trying, i am attaching here please
> confirm if it is correct way of creating the object.
>
> makeCurrent();
> fbo = new QGLFramebufferObject(100, 100);
> setWindowTitle(tr("OpenGL framebuffers 99999999999"));
> fbo->bind();
> fbo->drawTexture(QRectF(25,25,25,25),222,GL_TEXTURE_2D);
> QPainter paint(fbo);
> paint.fillRect(25,25,25,25,QColor(Qt::red));
> fbo->release();
>
> Thanks in Advance.....
>
>
>
> Regards
>
> Trinath
Newly allocated OpenGL textures will typically contain random
uninitialized data. To clear it you could do glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT); after binding the fbo.
--
Samuel
More information about the Qt-interest-old
mailing list