diff options
author | Samuel Fadel <samuel@nihil.ws> | 2023-06-04 13:02:14 +0200 |
---|---|---|
committer | Samuel Fadel <samuel@nihil.ws> | 2023-06-04 13:02:14 +0200 |
commit | fb23c8d47f6dcef429423256d8dddcc0f7184fc4 (patch) | |
tree | 34e0032f28df5807e4abd90d6b1b4baad24d2991 /shader.h | |
parent | 0f34fd437efb936ef29ac91186321aa7251fbfb1 (diff) |
Further advances in nuklear port.
Rendering now looks similar to Qt version, needs a few tweaks:
* Proper multisampling
* Background
Missing features:
* Barcharts
* Interactivity (e.g. brushing/linking in all objects)
* History view of interactions
Diffstat (limited to 'shader.h')
-rw-r--r-- | shader.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/shader.h b/shader.h new file mode 100644 index 0000000..feb5952 --- /dev/null +++ b/shader.h @@ -0,0 +1,37 @@ +#ifndef SHADER_H +#define SHADER_H + +#include <glad/gl.h> + +class Shader +{ +public: + Shader(const char *vertexSrc, const char *fragmentSrc, const char *geometrySrc = nullptr); + ~Shader(); + + GLuint program() const { return m_program; } + + GLint uniformLocation(const char *name) const; + + void setUniform(GLint location, GLint value) const; + void setUniform(GLint location, GLfloat value) const; + void setUniform(GLint location, GLfloat mat[4][4]) const; + void setUniform1dArray(GLint location, const GLfloat *values, int count) const; + void setUniform2dArray(GLint location, const GLfloat *values, int count) const; + void setUniform3dArray(GLint location, const GLfloat *values, int count) const; + + void setUniform(const char *name, GLint value) const; + void setUniform(const char *name, GLfloat value) const; + void setUniform(const char *name, GLfloat mat[4][4]) const; + void setUniform1dArray(const char *name, const GLfloat *values, int count) const; + void setUniform2dArray(const char *name, const GLfloat *values, int count) const; + void setUniform3dArray(const char *name, const GLfloat *values, int count) const; + + void use() const; + void release() const; + +private: + GLuint m_program; +}; + +#endif // SHADER_H |