parent
2acb74bb44
commit
81f5f3fe7b
10 changed files with 139 additions and 16 deletions
@ -0,0 +1,9 @@ |
|||||||
|
#version 330 core |
||||||
|
|
||||||
|
out vec4 FragColor; |
||||||
|
|
||||||
|
in vec3 color; |
||||||
|
|
||||||
|
void main() { |
||||||
|
FragColor = vec4(color, 1); |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<RCC> |
||||||
|
<qresource prefix="/shaders/"> |
||||||
|
<file>vertex.glsl</file> |
||||||
|
<file>fragment.glsl</file> |
||||||
|
</qresource> |
||||||
|
</RCC> |
@ -0,0 +1,11 @@ |
|||||||
|
#version 330 core |
||||||
|
|
||||||
|
layout (location = 0) in vec2 vPos; |
||||||
|
layout (location = 1) in vec3 vColor; |
||||||
|
|
||||||
|
out vec3 color; |
||||||
|
|
||||||
|
void main() { |
||||||
|
gl_Position = vec4(vPos, 0.0, 1.0); |
||||||
|
color = vColor; |
||||||
|
} |
@ -1,18 +1,25 @@ |
|||||||
#include <QOpenGLWidget> |
#include <QOpenGLWidget> |
||||||
#include <QOpenGLFunctions> |
#include <QOpenGLExtraFunctions> |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Pendulum; |
||||||
class Simulation; |
class Simulation; |
||||||
class FPS; |
class FPS; |
||||||
|
class QOpenGLShaderProgram; |
||||||
|
|
||||||
class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions { |
class GLWidget : public QOpenGLWidget, protected QOpenGLExtraFunctions { |
||||||
public: |
public: |
||||||
explicit GLWidget(Simulation *); |
explicit GLWidget(Simulation *); |
||||||
protected: |
protected: |
||||||
void paintEvent(QPaintEvent* e) override; |
|
||||||
void timerEvent(QTimerEvent* e) override; |
void timerEvent(QTimerEvent* e) override; |
||||||
|
void initializeGL() override; |
||||||
|
void paintGL() override; |
||||||
|
private slots: |
||||||
|
void initGPUMemory(const std::vector<Pendulum *> &addPendula); |
||||||
private: |
private: |
||||||
|
QOpenGLShaderProgram * program; |
||||||
|
GLuint VAO; |
||||||
|
GLuint positionVBO; |
||||||
|
GLsizei indexCount; |
||||||
Simulation * simulation; |
Simulation * simulation; |
||||||
FPS * fps; |
FPS * fps; |
||||||
static bool AnyDialogOpen(); |
static bool AnyDialogOpen(); |
||||||
|
Loading…
Reference in new issue