#include #include #include class MyOpenGLWidget : public QOpenGLWidget { public: MyOpenGLWidget(QWidget* parent = nullptr) : QOpenGLWidget(parent) {} void paintGL() override { QPainter painter(this); painter.setPen(Qt::white); painter.drawText(rect(), Qt::AlignCenter, "Qt"); } }; int main(int argc, char** argv) { QApplication app(argc, argv); MyOpenGLWidget w; w.show(); w.grab(); return 0; }