mirror of
https://gitlab.com/yikestone/qt_pi.git
synced 2025-08-03 05:34:13 +05:30
70 lines
1.3 KiB
C++
70 lines
1.3 KiB
C++
#ifndef MAPVIEW
|
|
#define MAPVIEW
|
|
|
|
#include "vertex.h"
|
|
|
|
#include <QDebug>
|
|
#include <QOpenGLBuffer>
|
|
#include <QOpenGLFunctions_3_1>
|
|
#include <QOpenGLShaderProgram>
|
|
#include <QOpenGLVertexArrayObject>
|
|
#include <QOpenGLWindow>
|
|
#include <QString>
|
|
#include <chrono>
|
|
#include <thread>
|
|
#include <unistd.h>
|
|
|
|
class QOpenGLShaderProgram;
|
|
|
|
class MapView : public QOpenGLWindow, protected QOpenGLFunctions_3_1 {
|
|
Q_OBJECT
|
|
public:
|
|
explicit MapView(QWidget *parent = 0);
|
|
~MapView();
|
|
|
|
void start_blinking();
|
|
void stop_blinking();
|
|
void toggle_blinking();
|
|
|
|
protected:
|
|
GLsizei count;
|
|
GLint startingElements[4] = {0, 4, 8, 12};
|
|
GLsizei counts[4] = {4, 4, 4, 4};
|
|
|
|
void initializeGL() override;
|
|
void paintGL() override;
|
|
void resizeGL(int, int) override;
|
|
void teardownGL();
|
|
void printContextInformation();
|
|
|
|
signals:
|
|
void update_GUI();
|
|
void keyPress(QKeyEvent *key);
|
|
|
|
private:
|
|
QOpenGLBuffer m_vertex;
|
|
QOpenGLVertexArrayObject m_object;
|
|
QOpenGLShaderProgram *m_program;
|
|
|
|
volatile int sleep_control = 1;
|
|
volatile int blinking;
|
|
|
|
std::thread *t;
|
|
|
|
void run();
|
|
void keyPressEvent(QKeyEvent *key) override;
|
|
// QTimer *t1;
|
|
// QTimer *t2;
|
|
// QTimer *t3;
|
|
// QTimer *t4;
|
|
// int blinking = 0;
|
|
// int state = 0;
|
|
// private slots:
|
|
// void t1Slot();
|
|
// void t2Slot();
|
|
// void t3Slot();
|
|
// void t4Slot();
|
|
};
|
|
|
|
#endif
|