#include "OpenGlWin.h" #include #include #include OpenGlWin::OpenGlWin(QWidget *parent): QOpenGLWidget(parent){ setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::WindowTransparentForInput); setAttribute(Qt::WA_TransparentForMouseEvents); setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_NoSystemBackground, false); QRect screenGeometry = QGuiApplication::primaryScreen()->geometry(); move(screenGeometry.topLeft()); setFixedSize(screenGeometry.width() - 1, screenGeometry.height() - 1); this->show(); } OpenGlWin::~OpenGlWin(){ } void OpenGlWin::paintGL() { QOpenGLFunctions* f = context()->functions(); f->glClearColor(0.0f, 0.0f, 0.0f, 0.0f); f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void OpenGlWin::resizeGL(int w, int h) { QOpenGLFunctions* f = context()->functions(); f->glViewport(0, 0, w, h); } void OpenGlWin::initializeGL() { QOpenGLFunctions* f = context()->functions(); f->glClearColor(0.0f, 0.0f, 0.0f, 0.0f); qDebug() << QString::fromLatin1((const char*)f->glGetString(GL_VENDOR)); qDebug() << QString::fromLatin1((const char*)f->glGetString(GL_RENDERER)); qDebug() << QString::fromLatin1((const char*)f->glGetString(GL_VERSION)); }