-
Notifications
You must be signed in to change notification settings - Fork 9
/
glblurfunctions.h
60 lines (45 loc) · 1.45 KB
/
glblurfunctions.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
57
58
59
60
#ifndef GLBLURFUNCTIONS_H
#define GLBLURFUNCTIONS_H
#include <QDebug>
#include <QtMath>
#include <QVector2D>
#include <QElapsedTimer>
#include <QOpenGLShaderProgram>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLContext>
#include <QOffscreenSurface>
#include <QOpenGLFramebufferObject>
#include <QOpenGLTexture>
#include "vertex.h"
class GLBlurFunctions : protected QOpenGLFunctions_3_3_Core
{
public:
GLBlurFunctions();
~GLBlurFunctions();
QImage blurImage_DualKawase(QImage imageToBlur, int offset, int iterations);
float getGPUTime();
float getCPUTime();
private:
void renderToFBO(QOpenGLFramebufferObject* targetFBO, GLuint sourceTexture, QOpenGLShaderProgram *shader);
void initFBOTextures();
QOpenGLShaderProgram *m_ShaderProgram_kawase_up;
QOpenGLShaderProgram *m_ShaderProgram_kawase_down;
QVector<QOpenGLFramebufferObject*> m_FBO_vector;
QOpenGLTexture *m_textureToBlur;
QOpenGLVertexArrayObject m_VertexArrayObject;
QOpenGLBuffer m_VertexBuffer;
QOffscreenSurface *m_Surface;
QOpenGLContext *m_Context;
int m_iterations;
QImage m_imageToBlur;
//GPU timer
GLuint GPUTimerQueries[1];
GLint GPUTimerAvailable;
GLuint64 GPUtimerElapsedTime;
//CPU timer
QElapsedTimer CPUTimer;
quint64 CPUTimerElapsedTime;
};
#endif // GLBLURFUNCTIONS_H