2016-01-12 12:55:22 +00:00
|
|
|
/*
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
FEEDBACK & QUESTIONS
|
|
|
|
|
|
|
|
For feedback and questions about stmbl please e-mail one of the authors named in
|
|
|
|
the AUTHORS file.
|
|
|
|
*/
|
|
|
|
|
2016-02-07 18:28:45 +00:00
|
|
|
#pragma once
|
2016-01-12 12:55:22 +00:00
|
|
|
|
|
|
|
#include <QOpenGLFunctions>
|
|
|
|
#include <QOpenGLBuffer>
|
|
|
|
#include <QOpenGLShaderProgram>
|
|
|
|
#include <QOpenGLVertexArrayObject>
|
2016-01-21 01:40:10 +00:00
|
|
|
#include <QOpenGLContext>
|
2016-01-12 12:55:22 +00:00
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
typedef std::chrono::steady_clock monoclock;
|
|
|
|
|
|
|
|
class FunctionGraph
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
QOpenGLBuffer m_vbo;
|
|
|
|
QOpenGLVertexArrayObject m_vao;
|
|
|
|
|
|
|
|
size_t m_xpos;
|
2016-01-21 01:40:10 +00:00
|
|
|
size_t m_data_mid;
|
2016-02-25 00:21:13 +00:00
|
|
|
size_t m_data_size;
|
2016-01-21 01:40:10 +00:00
|
|
|
|
|
|
|
bool m_filled;
|
2016-01-12 12:55:22 +00:00
|
|
|
|
2016-02-25 00:21:13 +00:00
|
|
|
QVector3D m_color;
|
|
|
|
|
|
|
|
public:
|
2016-01-12 12:55:22 +00:00
|
|
|
FunctionGraph();
|
|
|
|
void initializeGL();
|
2016-02-25 00:21:13 +00:00
|
|
|
void paintGL(QOpenGLShaderProgram *shader);
|
|
|
|
void addPoint(float y);
|
|
|
|
void setColor(float r, float g, float b);
|
2016-01-12 12:55:22 +00:00
|
|
|
void restart();
|
|
|
|
};
|