36 lines
623 B
C++
36 lines
623 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <GL/glew.h>
|
|
|
|
/// OpenGL shader
|
|
class Shader {
|
|
public:
|
|
Shader(GLenum type, const std::string &file_path, const std::vector<std::string> &flags = {});
|
|
~Shader();
|
|
|
|
GLuint getId() const {
|
|
return ShaderID;
|
|
}
|
|
|
|
static std::string getExt(GLenum type) {
|
|
switch (type) {
|
|
case GL_VERTEX_SHADER:
|
|
return "vs";
|
|
|
|
case GL_GEOMETRY_SHADER:
|
|
return "gs";
|
|
|
|
case GL_FRAGMENT_SHADER:
|
|
return "fs";
|
|
|
|
default:
|
|
return "??";
|
|
}
|
|
}
|
|
|
|
private:
|
|
GLuint ShaderID;
|
|
};
|