Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering into QOpenGLWidget produces broken output #1

Open
kblaschke opened this issue Aug 13, 2021 · 3 comments
Open

Rendering into QOpenGLWidget produces broken output #1

kblaschke opened this issue Aug 13, 2021 · 3 comments
Labels
bug Something isn't working need-help qt-frontend

Comments

@kblaschke
Copy link
Member

Describe the bug
After changing the Qt frontend to use QOpenGLWidget instead of QGLWidget, rendering output is broken.

At some point in the rendering queue, OpenGL resources become corrupted, e.g. vertex buffers have invalid or wrong contents (too few vertices). This subsequentially breaks the vertex shader and causes following commands to also fail, rendering garbage.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Application: Qt-based frontends
  • OS: Linux
  • Latest master

Additional context
The main difference between rendering into an SDL2 OpenGL or QGLWidget context is that the new QOpenGLWidget expects GL commands to render into a FBO instead of directly into the current GL context. ProjectM doesn't really care about OpenGL contexts or FBO usage, which might be the root cause of this issue.

RenderDoc captures of both the Qt and SDL frontends, using the same preset, can be found here.

@kblaschke kblaschke added bug Something isn't working need-help qt-frontend labels Aug 13, 2021
@kblaschke
Copy link
Member Author

Commit 237fe34 fixes the issue for now by providing a clean, native window projectM can render on. It's not ideal since hiding the mouse cursor is now a bit wonky (QWindow has different mouse events than QWidget), but at least the presets render correctly.

If someone has more experience with Qt's QOpenGLWidget specifics and knows how to make projectM render correctly into it, help is very much appreciated!

@Be-ing
Copy link

Be-ing commented Sep 14, 2021

I don't know how to help with this specific issue, but moving to QOpenGLWidget is definitely the way to go. QGLWidget has been removed in Qt6 (which requires rewriting Mixxx's entire GUI in QML because rendering the old QWidgets GUI revolves around QGLWidget APIs which have no equivalent in QOpenGLWidget).

@kblaschke
Copy link
Member Author

Ideally projectM should create its own internal context and render to a framebuffer object, which the integrating application can then copy to the buffer being displayed on screen, in this case the QOpenGLWidget's surface. Currently projectM has no knowledge of FBOs or contexts at all, it just renders to any context that's been made current when the render method is called each frame.

@kblaschke kblaschke transferred this issue from projectM-visualizer/projectm Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need-help qt-frontend
Projects
None yet
Development

No branches or pull requests

2 participants