Unsolved QQuickWidget::grabFrameBuffer does not work when format multisample is set
-
QQuickWidget::grabFrameBuffer does not work when format multisample is set. I can only get a gray picture. I reported this bug, but nobody open it...bug is here
code snippet like this:void Widget::init() { m_quickWidget = new QQuickWidget(this); QSurfaceFormat format; format.setSamples(8); m_quickWidget->setFormat(format); QUrl source("qrc:/rotatingsquare.qml"); m_quickWidget->resize(300,300); m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView ); m_quickWidget->setSource(source); connect(ui->pushButton, &QPushButton::clicked, this, &Widget::grabBuffer); } void Widget::grabBuffer() { QImage image = m_quickWidget->grabFramebuffer(); saveToFile(this, &image); }
-
Hi and welcome to devnet,
You don't give enough information in your bug.
It is missing:
- the Qt version
- the platform you run your application on
- a minimal compilable example that reproduces the behavior
-
Hi
Its not a bug. its how it works.
https://forum.qt.io/topic/64359/qopenglwidget-grabframebuffer-doesn-t-work-with-mutli-sampling
https://stackoverflow.com/questions/765434/glreadpixels-from-fbo-fails-with-multisamplingits using glReadPixels which does not support multisample.
Directly stated in openGL docs
https://www.khronos.org/opengl/wiki/GL_EXT_framebuffer_multisample
"Since you can't read the multisample buffer directly with glReadPixels since it would raise an error flag (GL_INVALID_OPERATION)," -
@SGaist Thank you very much.I use Qt 5.12.2, window 10 1809, and the demo is here : https://bugreports.qt.io/browse/QTBUG-75218
-
@mrjj said in QQuickWidget::grabFrameBuffer does not work when format multisample is set:
Hi
Its not a bug. its how it works.
https://forum.qt.io/topic/64359/qopenglwidget-grabframebuffer-doesn-t-work-with-mutli-sampling
https://stackoverflow.com/questions/765434/glreadpixels-from-fbo-fails-with-multisamplingits using glReadPixels which does not support multisample.
Directly stated in openGL docs
https://www.khronos.org/opengl/wiki/GL_EXT_framebuffer_multisample
"Since you can't read the multisample buffer directly with glReadPixels since it would raise an error flag (GL_INVALID_OPERATION),"Thank you verymuch. I use QQuickWidget's QQuickWindow get the current context,and blitFramebuffer function to slove it, but I think it is a bug, because multisample is a part of QQuickwidget.