Skip to content

Commit

Permalink
make the program id a field of the shader class
Browse files Browse the repository at this point in the history
  • Loading branch information
kazzmir committed Apr 28, 2024
1 parent 3123c45 commit 2877a98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/r-tech1/graphics/sdl2/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Graphics::Shader::~Shader(){

class LitShader: public Graphics::Shader {
public:
GLuint programId;

LitShader(){
GLuint programId = 0;
// GLuint programId = 0;
programId = glCreateProgram();
GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
string fragmentPath = "shaders/lit-sprite.fragment.glsl";
Expand Down Expand Up @@ -134,6 +136,10 @@ class LitShader: public Graphics::Shader {
DebugLog << "Could not create lit shader: " << failure.what() << endl;
}
}

virtual ~LitShader(){
glDeleteProgram(programId);
}
};

map<string, Graphics::Shader*> shaders;
Expand Down

0 comments on commit 2877a98

Please sign in to comment.