Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to show FBO contents in a QGLWidget?

How to show FBO contents in a QGLWidget?

Scheduled Pinned Locked Moved General and Desktop
fbo qglwidget q
1 Posts 1 Posters 455 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Justin Sayne
    wrote on last edited by
    #1

    I basically tried it this way:

      class Foo : public QGLWidget
      {
      public:
        Foo( QWidget* parent ) : QGLWidget( parent )
        {
        }
    
        void paintGL() override
        {
          QOpenGLFramebufferObject  fbo( size( ) );
          fbo.bind( );
          glClearColor( 1.0f, 0.0f, 0.0f, 1.0f );
          glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
          fbo.release( );
          bindTexture( fbo.toImage( ), fbo.format( ).textureTarget( ), fbo.format( ).internalTextureFormat( ) );
          drawTexture( rect( ), fbo.texture( ), fbo.format( ).textureTarget( ) );
        }
      };
    

    but the widget will just show a black background then. I've also tried to bind the fbo texture and draw a quad - same result. If I uncomment the fbo code and draw directly to the GLWidget it works as expected. Any hints about what I'm doing wrong here?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved