#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<opencv2/opencv.hpp>
#include <QtOpenGL>
#include <QOpenGLFunctions>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::initializeGL()
{
QOpenGLFunctions asxf;
asxf.initializeOpenGLFunctions();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
void MainWindow::resizeGL(int w, int h)
{
glViewport(0, 0, w, h);
}
void MainWindow::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT);
}
I want to use OpenGL modules in QT, but when I couldn’t use the static `initialize` function, I tried calling it with a variable named `asfx`, but the background didn’t turn out as black as I wanted.