MyOpenglWidget::MyOpenglWidget(QWidget *parent) : QOpenGLWidget{parent} { auto &mysignal = MySignal::instance(); // 绘制和清空 connect(&mysignal,&MySignal::drawSignal,this,[&](Shape shape){ drawShape(shape); }); // 设置渲染模式(线段、或者面填充) connect(&mysignal,&MySignal::renderModeSignal,this,[&](renderMode mode){ makeCurrent(); if(mode == renderMode::Fill) { glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); } else { glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); } doneCurrent(); update();update(); }); // 写到构造函数里 // 开启抗锯齿 QSurfaceFormat surfaceFormat; surfaceFormat.setSamples(5);//多重采样 setFormat(surfaceFormat); //setFormat是QOpenGLWidget的函数 }
标签:surfaceFormat,抗锯齿,Qt,MySignal,opengl,BACK,mysignal,GL From: https://www.cnblogs.com/RedWetPlace/p/17964075