[Interest] QuickFrameBufferObject does not redraw

Wehmer, Matthias Matthias.Wehmer at draeger.com
Wed Sep 16 10:34:31 CEST 2015


Hi Laszlo,

 

Thanks for your help. Actually I have read about this, too.

So I added the following lines at the top of the render method:

 

void Drawer::render()

{

    QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());

    glFuncs.glUseProgram(0);

 

 

Unfortunately this does not seem to change anything. Is the usage of the
glFuncs at least correct?

What are other possibilities of a wrongly set state besides the shader
programs?

 

Best regards

Matthias

From: Agocs Laszlo [mailto:laszlo.agocs at theqtcompany.com] 
Sent: Wednesday, September 16, 2015 10:20 AM
To: Wehmer, Matthias; interest at qt-project.org
Subject: Re: QuickFrameBufferObject does not redraw

 

Hi,

 

You most likely have some state set that affects your custom rendering. For
example you will probably have a program active which is not ideal in your
case. Try adding a glUseProgram(0).

 

See the slightly enhanced 5.5 docs at
http://doc.qt.io/qt-5/qquickframebufferobject-renderer.html#render

 

Best regards,

Laszlo

 

  _____  

From: interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org
<interest-bounces+laszlo.agocs=theqtcompany.com at qt-project.org> on behalf of
Wehmer, Matthias <Matthias.Wehmer at draeger.com>
Sent: Wednesday, September 16, 2015 8:34 AM
To: interest at qt-project.org
Subject: [Interest] QuickFrameBufferObject does not redraw 

 

Hi everybody,

 

I am currently experimenting with the QFrameBufferObject and try to draw via
raw OpenGL calls.

 

The relevant part of the render function in the
QuickFrameBuffrObject::Renderer looks like this:

 

void Drawer::render()

{

    int width = 1.0f;

    int height = 1.0f;

    glEnable(GL_BLEND);

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glColor4f(0.0, 0.0, 1.0, 0.8);

 

    // Drawing background

    glBegin(GL_QUADS);

    glVertex2f(-1.0f, -1.0f);

    glVertex2f(width, -1.0f);

    glVertex2f(width, height);

    glVertex2f(-1.0f, height);

    glEnd();

 

    if( m_window != nullptr )

        m_window->resetOpenGLState();

 

//    update();

}

 

The problem is, that after resizing the window or conducting any other
changes to the scene, the scene does not update. In case of resizing the
screen it got cleared and does not draw anything new. When debugging I can
observe, that the render function as well as the createFrameBuffer methods
are called and work correctly.

When searching the web, there are the following potential error sources:

-          Shader program is overwritten

-          Wrong OpenGl context is used

-          OpenGL state is not reset

 

Do you have any experiences with this and can you see, where the error in my
example might be?

 

Thanks a lot!

 

Best regards

Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150916/144fa352/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5658 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150916/144fa352/attachment.bin>


More information about the Interest mailing list