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. QOpenGLWidget's format(smaples) would be reset As QGraphicsView’s viewport
Forum Updated to NodeBB v4.3 + New Features

QOpenGLWidget's format(smaples) would be reset As QGraphicsView’s viewport

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 133 Views
  • 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.
  • S Offline
    S Offline
    SuperAo
    wrote on last edited by
    #1

    I try to enable MSAA in QOpenGLWidget, So I set the format samples as 8. Everything is fine in QGraphicsView's constructor. But MSAA does not work, then I find in drawcall function, format samplels == 0 ! Here are codes;
    QGraphicsView's constructor code :

            auto gl_widget = new SGOpenGLWidget(this);
    	QSurfaceFormat fmt = gl_widget->format();
    
    	setViewport(gl_widget);
    	auto view_widget = this->viewport();
    	QOpenGLWidget* gg_widget = dynamic_cast<QOpenGLWidget*>(view_widget);
    	if (gg_widget)
    	{
    		auto fmt = gg_widget->format();  
    		auto num = fmt.samples(); // num is 8,bacause i set it as deafult format
    	}
    

    but at QGraphicsView::drawBackground(QPainter* painter, const QRectF& rect) , code is here:

    auto view_widget = this->viewport();
    		QOpenGLWidget* gl_widget = dynamic_cast<QOpenGLWidget*>(view_widget);
    		if (gl_widget)
    		{
    			auto fmt = gl_widget->format();
    			
    			auto num = fmt.samples(); // samples num becomes 0! 
    			fmt.setSamples(4);
    			gl_widget->setFormat(fmt);// not work
    			auto size = fmt.depthBufferSize();
    			auto gl_ctx = gl_widget->context();
    			auto ctx_fmt = gl_ctx->format();
    			auto ctx_num = ctx_fmt.samples();
    		}
    

    So SMAA does not work at all. Is it a bug in Qt?

    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