36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
#ifndef SHADER_H
|
|
#define SHADER_H
|
|
|
|
#include "opengl.h"
|
|
#include <string>
|
|
#include <glm/fwd.hpp>
|
|
|
|
class Shader
|
|
{
|
|
GLuint program;
|
|
GLuint createShader(const std::string &source, GLenum shaderType);
|
|
void printShaderInfoLog(GLuint shaderId);
|
|
void printProgramInfoLog(GLuint programId);
|
|
|
|
public:
|
|
Shader(const std::string &vertexSource, const std::string &fragmentSource);
|
|
Shader(const std::string &vertexSource, const std::string &geometrySource, const std::string &fragmentSource);
|
|
~Shader();
|
|
GLuint getLocation(std::string attribName);
|
|
|
|
void bind();
|
|
void unbind();
|
|
void bindFloat(GLuint location, float val);
|
|
void bindMat3(GLuint location, const glm::mat3 &mat);
|
|
void bindMat4(GLuint location, const glm::mat4 &mat);
|
|
void bindMat4Array(GLuint location, const glm::mat4 *matrices, int nbMat);
|
|
void bindVec2(GLuint location, const glm::vec2 &vec);
|
|
void bindVec3(GLuint location, const glm::vec3 &vec);
|
|
void bindVec4(GLuint location, const glm::vec4 &vec);
|
|
void bindVec3Array(GLuint location, const glm::vec3* vec, int nb_elements);
|
|
void bindUnsignedInteger(GLuint location, GLuint unsigned_integer);
|
|
void bindInteger(GLuint location, GLint integer);
|
|
};
|
|
|
|
#endif // SHADER_H
|