-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgpurender.h
executable file
·88 lines (68 loc) · 1.99 KB
/
gpurender.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef GPU_RENDER_H
#define GPU_RENDER_H
#include <QOpenGLWidget>
#include <QOpenGLExtraFunctions>
#include <QOpenGLTexture>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <vector>
#include "v4l2capture.h"
#include "model.h"
#include "cameraparameter.h"
#include "camera3d.h"
QT_BEGIN_NAMESPACE
class QGestureEvent;
QT_END_NAMESPACE
extern "C"
{
#include <pthread.h>
}
class GpuRender : public QOpenGLWidget, protected QOpenGLExtraFunctions
{
Q_OBJECT
public:
explicit GpuRender(QWidget *parent = 0);
~GpuRender();
void allocate_buffer(uint num);
void setBuf(QVector<V4l2Capture::CapBuffers *> &pbuf);
void enablePaint();
void setCameraPara(QVector<CameraParameter> &p);
public slots:
protected:
void initializeGL() Q_DECL_OVERRIDE;
void paintGL() Q_DECL_OVERRIDE;
void resizeGL(int w, int h) Q_DECL_OVERRIDE;
bool event(QEvent *e) Q_DECL_OVERRIDE;
#define PLANES 4
private:
typedef void (GL_APIENTRY *PFNGLTEXDIRECTVIVMAP)
(GLenum Target, GLsizei Width, GLsizei Height,
GLenum Format, GLvoid ** Logical, const GLuint *Physical);
typedef void (GL_APIENTRY *PFNGLTEXDIRECTINVALIDATEVIV) (GLenum Target);
PFNGLTEXDIRECTVIVMAP pFNglTexDirectVIVMap;
PFNGLTEXDIRECTINVALIDATEVIV pFNglTexDirectInvalidateVIV;
QVector<QString> cameraNames;
QVector<Model*> objModels;
QVector<CameraParameter> *camParas;
QSize textureSize;
GLuint textureCam;
GLint textureLoc;
GLint extrinsicLoc;
QOpenGLShaderProgram *m_program;
GLuint indexTransformBlock;
GLuint programId;
GLuint idUbo;
GLint blockSize;
GLfloat *pblockBuf;
QVector<V4l2Capture::CapBuffers *> buffers;
// std::vector<void *> pTexBuffers;
pthread_mutex_t gpu_mutex;
pthread_cond_t gpu_cond;
bool paintFlag;
unsigned char *alphaMasks[PLANES];
GLuint maskTextureID[PLANES];
GLint maskTextureLoc;
Camera3D *camera3D;
};
#endif // GPU_RENDER_H