X-Git-Url: http://git.mutantstargoat.com?p=demo;a=blobdiff_plain;f=src%2Fopengl%2Fshader-gl.h;h=635d6b7dd3845c4e40ca619aa3120880c3d696a6;hp=ea3b1c15ecc0f28af17081ccaf55985acbdd104c;hb=31bab00bc3b476be9814c1ee06b9a2f0dc77d4e9;hpb=826b0cf7adaf8b1dc4c37f57a4a98c79a3995e21 diff --git a/src/opengl/shader-gl.h b/src/opengl/shader-gl.h index ea3b1c1..635d6b7 100644 --- a/src/opengl/shader-gl.h +++ b/src/opengl/shader-gl.h @@ -6,30 +6,48 @@ class ShaderGL : public Shader { protected: /* bsz for vulkan, in opengl buf is 0 terminated */ - unsigned int sdr; virtual bool create(char *buf, unsigned int bsz, const char *fname); public: + unsigned int sdr; + ShaderGL(); virtual ~ShaderGL(); - virtual void destroy(); - virtual void attach(unsigned int prog); + virtual void destroy() override; }; class ShaderProgramGL : public ShaderProgram { protected: unsigned int prog; + bool is_linked; public: ShaderProgramGL(); virtual ~ShaderProgramGL(); - void destroy(); - void delete_shaders(); - virtual bool link(); - virtual bool load(const char *vfname, const char *ffname); - virtual void use(); + virtual void cache_uniforms() override; + + virtual bool link() override; + virtual bool use() override; + virtual bool create() override; + virtual void destroy() override; + virtual void attach_shader(Shader *shader) override; + + int get_uniform_location(const char *name) const; + int get_attribute_location(const char *name) const; + + virtual void set_uniformi(int location, int value) override; + virtual void set_uniformi(int location, int x, int y) override; + virtual void set_uniformi(int location, int x, int y, int z) override; + virtual void set_uniformi(int location, int x, int y, int z, int w) override; + + virtual void set_uniformf(int location, float value) override; + virtual void set_uniformf(int location, float x, float y) override; + virtual void set_uniformf(int location, float x, float y, float z) override; + virtual void set_uniformf(int location, float x, float y, float z, float w) override; + + virtual void set_uniform_matrix(int location, const Mat4 &mat) override; }; #endif // SHADER_GL_H_ \ No newline at end of file