1 #ifndef ABSTRACTRENDERER_H 2 #define ABSTRACTRENDERER_H 7 #include <QMutexLocker> 9 #include <QOpenGLFunctions> 37 virtual void paint(QMatrix4x4 mvpMatrix, QVector3D camPos) = 0;
53 initializeOpenGLFunctions();
91 bool hadError =
false;
94 while ((error = glGetError()) != GL_NO_ERROR) {
96 case GL_INVALID_ENUM: qDebug() <<
"GL_INVALID_ENUM";
break;
97 case GL_INVALID_VALUE: qDebug() <<
"GL_INVALID_VALUE";
break;
98 case GL_INVALID_OPERATION: qDebug() <<
"GL_INVALID_OPERATION";
break;
99 case GL_INVALID_FRAMEBUFFER_OPERATION: qDebug() <<
"GL_INVALID_FRAMEBUFFER_OPERATION";
break;
100 case GL_OUT_OF_MEMORY: qDebug() <<
"GL_OUT_OF_MEMORY";
break;
101 case GL_STACK_UNDERFLOW: qDebug() <<
"GL_STACK_UNDERFLOW";
break;
102 case GL_STACK_OVERFLOW: qDebug() <<
"GL_STACK_OVERFLOW";
break;
103 default: qDebug() <<
"Unknown error.";
break;
121 #endif // ABSTRACTRENDERER_H void makeContextCurrent()
virtual void cleanUp()=0
This slot should clean up all resources associated to the renderer.
virtual void paint(QMatrix4x4 mvpMatrix, QVector3D camPos)=0
Uses OpenGL commands to draw to the frame buffer. Nothing is assumed about the previous contents of t...
void doneContextCurrent()
void requestUpdate()
Calling this slot makes the renderer update itself when possible.
Definition: abstractrenderer.h:63
void initializeGL()
Initializes OpenGL-related details.
Definition: abstractrenderer.h:51
virtual void initializeRenderer()=0
Used to initialize renderer parameters that require an OpenGL context to be bound.
Something that renders a 3D scene to the screen using OpenGL.
Definition: abstractrenderer.h:18
virtual ~AbstractRenderer()
Definition: abstractrenderer.h:24
virtual void create()
This is (should be) called on an OpenGL thread before this object is used. Allows the renderer to ini...
Definition: abstractrenderer.h:46
bool checkGLErrors()
Helper method to loop glGetError() and print out all current errors.
Definition: abstractrenderer.h:89
void repaintNeeded()
Emitted when the renderer has updates to make to its image.