# HG changeset patch # User Teemu Piippo # Date 1655748857 -10800 # Node ID b8ad4c12d937086e0edaa4bdee842a8732581f3e # Parent 10a6298f636f1c544ea0dcfd46136414bd60cbed Fix pick scene rendering: we cannot use glReadPixels when using multisampling, so we need to render the pick scene to a separate frame buffer diff -r 10a6298f636f -r b8ad4c12d937 src/gl/partrenderer.cpp --- a/src/gl/partrenderer.cpp Mon Jun 20 19:49:56 2022 +0300 +++ b/src/gl/partrenderer.cpp Mon Jun 20 21:14:17 2022 +0300 @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -461,13 +462,15 @@ const gl::RenderStyle oldRenderStyle = this->renderPreferences.style; this->renderPreferences.style = gl::RenderStyle::PickScene; this->makeCurrent(); + QOpenGLFramebufferObject fbo{this->width(), this->height(), QOpenGLFramebufferObject::CombinedDepthStencil}; + fbo.bind(); this->renderScene(); std::array data; this->checkForGLErrors(); glfunc.glReadPixels(where.x(), where.y(), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &data[0]); this->checkForGLErrors(); + fbo.release(); this->renderPreferences.style = oldRenderStyle; - this->update(); return gl::idFromColor(data); }