-
Notifications
You must be signed in to change notification settings - Fork 0
/
glwidget.h
57 lines (42 loc) · 1.21 KB
/
glwidget.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
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <opencv2/opencv.hpp>
#include <QPaintEngine>
#include <QPaintEvent>
#include <QQueue>
#include <QGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
#include "distance_point.h"
#include "thread_safe_queue.h"
#define FRAME_TIMEOUT_MS 10
#define RECT_SIZE 10
class GLWidget : public QGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
GLWidget(QList<QSharedPointer<DistancePoint>> *_distancePointList, ThreadSafeQueue<QImage> *q_, QWidget *parent = 0);
QSize minimumSizeHint() const;
QSize sizeHint() const;
void mousePressEvent(QMouseEvent *e);
public slots:
void onNewFrame();
signals:
void measuringPointCoordsChanged(QPoint widgetPos, QSize widgetSize);
protected:
void initializeGL();
void paintEvent(QPaintEvent *event);
void resizeGL(int width, int height);
private:
QImage _image;
GLuint background;
QMutex _mutex;
int viewWidth;
int viewHeight;
void setupViewPort(int width, int height);
QList<QSharedPointer<DistancePoint>> *distancePointList;
ThreadSafeQueue<QImage> *imageDistanceQueue;
QOpenGLTexture* texture;
void static drawFramePicture();
};
#endif // GLWIDGET_H