Let's get started by following these steps:
- We will create a new class called RenderWindow, which inherits from the QOpenGLWindow class. Go to File | New File or Project, then select C++ Class under Files and Classes category. Name the class RenderWindow and set its base class as QOpenGLWindow. Then, proceed to create the C++ class:
- Go to the renderwindow.h file we just created and add the following headers at the top of the source code:
#include <GL/glu.h>#include <QtOpenGL>#include <QSurfaceFormat>#include <QOpenGLFunctions>#include <QOpenGLWindow>#include <QOpenGLBuffer>#include <QOpenGLVertexArrayObject>#include <QOpenGLShader> ...