forked from torriem/QtAgOpenGPS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
aogrenderer.h
56 lines (42 loc) · 1.2 KB
/
aogrenderer.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef OPENGLCONTROL_H
#define OPENGLCONTROL_H
#include <QQuickWindow>
//#include <QOpenGLContext>
#include <QQuickFramebufferObject>
#include <functional>
Q_DECLARE_METATYPE(std::function<void (void)>)
class AOGRenderer : public QQuickFramebufferObject::Renderer
{
protected:
virtual void synchronize(QQuickFramebufferObject *);
bool isInitialized;
public:
AOGRenderer();
~AOGRenderer();
void render();
QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);
/*
void registerPaintCallback(std::function<void ()> callback);
void registerInitCallback(std::function<void ()> callback);
void registerCleanupCallback(std::function<void ()> callback);
*/
private:
QQuickWindow *win;
bool calledInit;
//FormGPS *mf;
int samples;
//callback in main form to do actual rendering
void *callback_object;
std::function<void (void)> paintCallback;
std::function<void (void)> initCallback;
std::function<void (void)> cleanupCallback;
};
class AOGRendererInSG : public QQuickFramebufferObject
{
Q_OBJECT
public:
AOGRenderer *theRenderer;
AOGRendererInSG();
AOGRenderer *createRenderer() const;
};
#endif // OPENGLCONTROL_H