Pārlūkot izejas kodu

Fix rendering on Wayland

For unknown reasons, renderTargetId() is not the render target on
Wayland. Instead, QtQuick is made to render into a separate FBO, most
likely because QtWayland has to render window decorations on the actual
window surface, and the FBO indirection serves to take care of the
resulting mess.

renderTargetId() getting misidrected still sounds like a bug to me.
Fortunately, we can just retrieve the actually bound FBO. This works and
must works, or even official Qt examples would break. It's not so good
that we have to retrieve it from the OpenGL state, because in theory a
driver could make it inefficient, but I'd say the risk is low.
Vincent Lang 9 gadi atpakaļ
vecāks
revīzija
cf6aa280b9
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      src/player/PlayerQuickItem.cpp

+ 2 - 1
src/player/PlayerQuickItem.cpp

@@ -155,7 +155,8 @@ PlayerRenderer::~PlayerRenderer()
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 void PlayerRenderer::render()
 {
-  int fbo = m_window->renderTargetId();
+  GLint fbo = 0;
+  QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbo);
 
   m_window->resetOpenGLState();