X-Git-Url: http://git.mutantstargoat.com?a=blobdiff_plain;f=src%2Fopengl%2Fshader-gl.cc;h=296a67cdca828ede662299757c5a0bc5be37ad4f;hb=0f6519c2606f2863d9c7ee8b9754b9f23df281ab;hp=2b917543816cbbf32c5f07be1625f250d9249239;hpb=fcd6773bc770425ede4b47a84eef7cc78342542c;p=demo diff --git a/src/opengl/shader-gl.cc b/src/opengl/shader-gl.cc index 2b91754..296a67c 100644 --- a/src/opengl/shader-gl.cc +++ b/src/opengl/shader-gl.cc @@ -2,7 +2,6 @@ #include #include -#include "state_manager.h" #include "opengl/shader-gl.h" ShaderGL::ShaderGL() @@ -132,7 +131,7 @@ bool ShaderProgramGL::link() bool ShaderProgramGL::use() const { - if(!is_linked) { //&& !link()) { + if(!is_linked) { return false; } @@ -156,93 +155,3 @@ void ShaderProgramGL::attach_shader(Shader *shader) glAttachShader(prog, ((ShaderGL *)shader)->sdr); is_linked = false; } - -int ShaderProgramGL::get_uniform_location(const char *name) const -{ - if(!use()) - return -1; - - return glGetUniformLocation(prog, name); -} - -void ShaderProgramGL::set_uniformi(int location, int value) -{ - if(!use() || location == -1) { - return; - } - - glUniform1i(location, value); -} - -void ShaderProgramGL::set_uniformi(int location, int x, int y) -{ - if(!use() || location == -1) { - return; - } - - glUniform2i(location, x, y); -} - -void ShaderProgramGL::set_uniformi(int location, int x, int y, int z) -{ - if(!use() || location == -1) { - return; - } - - glUniform3i(location, x, y, z); -} - -void ShaderProgramGL::set_uniformi(int location, int x, int y, int z, int w) -{ - if(!use() || location == -1) { - return; - } - - glUniform4i(location, x, y, z, w); -} - -void ShaderProgramGL::set_uniformf(int location, float value) -{ - if(!use() || location == -1) { - return; - } - - glUniform1f(location, value); -} - -void ShaderProgramGL::set_uniformf(int location, float x, float y) -{ - if(!use() || location == -1) { - return; - } - - glUniform2f(location, x, y); -} - -void ShaderProgramGL::set_uniformf(int location, float x, float y, float z) -{ - if(!use() || location == -1) { - return; - } - - glUniform3f(location, x, y, z); -} - -void ShaderProgramGL::set_uniformf(int location, float x, float y, float z, float w) -{ - if(!use() || location == -1) { - return; - } - - glUniform4f(location, x, y, z, w); -} - -void ShaderProgramGL::set_uniform_matrix(int location, const Mat4 &mat) -{ - if(!use() || location == -1) { - fprintf(stderr, "FOO\n"); - return; - } - - glUniformMatrix4fv(location, 1, GL_TRUE, (float *)&mat.m[0][0]); -} \ No newline at end of file