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. Capture widget with OpenGL content
Forum Updated to NodeBB v4.3 + New Features

Capture widget with OpenGL content

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.8k 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
    JulienMaille
    wrote on last edited by
    #1

    Hello, sorry to make a thread from a stackoverflow post but basically I have the exact same problem and I was wondering if I'm forced to use the same workaround

    http://stackoverflow.com/questions/1339379/qt-mdi-app-with-opengl-how-to-grab-a-valid-screenshot

    [quote]
    I need to programmatically capture a screenshot of the application's main window, including some OpenGL widgets

    Now here's what I've tried so far:

    • QPixmap::grabWidget doesn't work for the subwindows that use shader programs, apparently because the redirection context does not seem to support the necessary OpenGL extensions. (The rendering code checks that the associated context supports the required extensions, and refuses to continue if not.)
    • QPixmap::grabWindow silently leaves all OpenGL contexts empty -- even those that use basic primitives only.
    • QGLWidget::grabFrameBuffer works, but captures only the OpenGL context of the specific subwindow, whereas I'd like to grab the whole application (essentially what Alt+PrtScr does in Windows).[/quote]
    1 Reply Last reply
    0
    • T3STYT Offline
      T3STYT Offline
      T3STY
      wrote on last edited by
      #2

      The easiest way I can see is using grabWindow() first, which leaves empty (black?) OpenGL area, and then use grabFrameBuffer() on the OpenGL context, and paste that into the previously grabbed image. Looks like 2 steps to me, probably fast and efficient enough (still better than 3rd post in the link above, suggesting to screenshot each widget separately...)

      Also, please note that the thread you linked refers to Qt OpenGL module from Qt 4.x. If you're using Qt 5 things might be different.

      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