32 lines
813 B
C++
32 lines
813 B
C++
#ifndef SHADER_H
|
|
#define SHADER_H
|
|
|
|
#include <glew/glew.h>
|
|
#include <string>
|
|
#include <glm/fwd.hpp>
|
|
#include <QString>
|
|
|
|
class Shader
|
|
{
|
|
static const std::string DEFAULT_VERT;
|
|
static const std::string DEFAULT_FRAG;
|
|
GLuint program;
|
|
GLuint createShader(const QString* filename, GLenum shaderType);
|
|
void printShaderInfoLog(GLuint shaderId);
|
|
void printProgramInfoLog(GLuint programId);
|
|
|
|
public:
|
|
Shader(const QString* vertexSource, const QString* fragmentSource);
|
|
~Shader();
|
|
GLuint getLocation(std::string attribName);
|
|
|
|
void bind();
|
|
void unbind();
|
|
void bindFloat(GLuint location, float val);
|
|
void bindMatrix(GLuint location, glm::mat4 mat);
|
|
void bindVec3(GLuint location, glm::vec3 vec);
|
|
void bindTexture(GLuint location, GLuint tex_id);
|
|
};
|
|
|
|
#endif // SHADER_H
|