Skip to content

Instantly share code, notes, and snippets.

@anlsh
Last active August 29, 2015 14:25
Show Gist options
  • Save anlsh/6e3023b1831ade9af0e3 to your computer and use it in GitHub Desktop.
Save anlsh/6e3023b1831ade9af0e3 to your computer and use it in GitHub Desktop.
#ifndef TINY2D_SHADERS_H
#define TINY2D_SHADERS_H
#define GLEW_STATIC
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <stdexcept>
#include <fstream>
#define LOAD_FROM_FILE 0
#define LOAD_FROM_STRING 1
namespace t2d {
class Shader {
public:
Shader(const char *, GLenum, int);
~Shader();
std::string source;
const GLchar * glSource;
GLuint id;
};
class ShaderCompilationError : public std::runtime_error {
public:
// I know the following line is a bit bugged
ShaderCompilationError(): runtime_error("Shader failed to compile: Line " +
std::to_string(__LINE__) + " of " + __FILE__ + "\n") {}
};
}
#endif //TINY2D_SHADERS_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment