-
Notifications
You must be signed in to change notification settings - Fork 22
/
glwidget.cpp
41 lines (29 loc) · 879 Bytes
/
glwidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "glwidget.h"
GLWidget::GLWidget(QWidget *parent)
:QOpenGLWidget(parent)
{
}
GLWidget::~GLWidget()
{
}
void GLWidget::setPaintGLCallback(std::function<void ()> callback) {
paintGL_callback = callback;
}
void GLWidget::setInitializeGLCallback(std::function<void ()> callback) {
initializeGL_callback = callback;
}
void GLWidget::initializeGL() {
//call the callback so the main form can load textures
if(initializeGL_callback) initializeGL_callback();
}
void GLWidget::paintGL() {
//call back to the main form since this needs access to main form
//variables.
if(paintGL_callback) paintGL_callback();
//notify main loop we're done.
emit afterRender();
}
void GLWidget::resizeGL(int _width, int _height) {
//This should really only be used to resize FBOs and such.
//identity matrix stuff should go in paintGL.
}