[Qt-interest] Problem in creating empty QGLFrameBufferObject
trinathpujari
trinathpujari at tataelxsi.co.in
Thu Nov 12 15:08:57 CET 2009
Samuel Rødal wrote:
> 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
>
Hi Samuel,
Thanks for reply. Now i can create a QGLFrameBuffer with
empty data means black screen.
But just i am looking at the examples and no where i can find
how to write texts into the buffer and displaying it.
And how to hide the buffer from showing in the widget.
Actually my requirements are to write some string data into the
buffer and display it on the secondary LCD device which takes buffer for
rendering the data.
Regards
Trinath
Hi Samuel,
Thanks for your reply.
Actually now i am creating a string and rendering into the
QGLFrameBuffer and try it to display same QGLWidget.
const char *line1="AVAYA";
svg_renderer = new QSvgRenderer(QByteArray(line1), this);
connect(svg_renderer, SIGNAL(repaintNeeded()), this, SLOT(draw()));
QPainter fbo_painter(fbo);
svg_renderer->render(&fbo_painter);
fbo_painter.end();
Can you tell me is it right way to do the things....
Regards
Trinath
More information about the Qt-interest-old
mailing list