-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshader.h
39 lines (27 loc) · 916 Bytes
/
shader.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
#ifndef SHADER_H
#define SHADER_H
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLFunctions>
#include <iostream>
class Shader
{
public:
Shader(QString vertexShader, QString fragmentShader, QOpenGLContext *ogl);
~Shader();
void drawObject(QOpenGLFunctions *ogl);
QOpenGLShaderProgram* getShaderProgram(){return m_program;}
QOpenGLVertexArrayObject* getVAO(){return &m_vao;}
QOpenGLBuffer* getVBO(){return &m_vbo;}
QOpenGLBuffer* getEBO(){return &m_ebo;}
void loadToVAO(QVector<float> vertices, QVector<int> indices); //vnt: vertices, normals, textureCoords
void releaseShader();
QOpenGLContext* ogl_;
private:
QOpenGLVertexArrayObject m_vao;
QOpenGLBuffer m_vbo;
QOpenGLBuffer m_ebo; //element buffer object = indices buffer object
QOpenGLShaderProgram *m_program;
};
#endif // SHADER_H