aboutsummaryrefslogtreecommitdiff
#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