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. Using Shaders on a QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

Using Shaders on a QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 986 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.
  • T Offline
    T Offline
    theoribeiro
    wrote on last edited by
    #1

    Hello,

    I need to show a 2D scene using different views (on different positions of the scene). I need also to apply a shader program to each of these views.
    My first thought was to use a QGraphicsScene and Views that shared the same scene. Much like the Chip example. So I created a subclass of QGLWidget that contained the shader program. An instance of this class is set as the Viewport of each QGraphicsView widgets I'm using.

    However, although my shader is compiling and linking correctly, nothing happens. I learned somewhere on these forums that I can't use regular painting on my QGLWidget subclass, as the QGraphics framework does its own painting and "bypasses" the QGLWidget painting, and therefore, the shaders wouldn't work.

    I cannot use QML because I really need two "windows" (views) to share the exact same scene. I cannot duplicate everything because most of the items are videos and that will compromise the performance.

    What is the best way to accomplish what I'm trying to do? Should I just go to plain OpenGL native painting and lose all the benefits of a Graphics Scene and the QGraphics Framework? Is there a way to enforce the shaders being used by QGraphicsView? Should I use QML and try to share the scene in any way?

    I appreciate each and every contribution. I'm completely lost here.

    Best regards,
    Theo

    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