From: Steinar H. Gunderson Date: Mon, 1 Oct 2012 23:24:57 +0000 (+0200) Subject: Less old-style GLSL extension use. X-Git-Tag: 1.0~441 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=96a1cff51a8b7dc45ebe725e0d0685eecce31331;hp=40b66ccabf2c2f448504a41909ff2dda80212af4;p=movit Less old-style GLSL extension use. --- diff --git a/effect.cpp b/effect.cpp index 08e9c3a..3a4f8c8 100644 --- a/effect.cpp +++ b/effect.cpp @@ -9,7 +9,7 @@ #include #include -void set_uniform_float(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, float value) +void set_uniform_float(GLuint glsl_program_num, const std::string &prefix, const std::string &key, float value) { std::string name = prefix + "_" + key; GLint l = glGetUniformLocation(glsl_program_num, name.c_str()); @@ -21,7 +21,7 @@ void set_uniform_float(GLhandleARB glsl_program_num, const std::string &prefix, check_error(); } -void set_uniform_vec2(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, const float *values) +void set_uniform_vec2(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values) { std::string name = prefix + "_" + key; GLint l = glGetUniformLocation(glsl_program_num, name.c_str()); @@ -33,7 +33,7 @@ void set_uniform_vec2(GLhandleARB glsl_program_num, const std::string &prefix, c check_error(); } -void set_uniform_vec3(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, const float *values) +void set_uniform_vec3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values) { std::string name = prefix + "_" + key; GLint l = glGetUniformLocation(glsl_program_num, name.c_str()); @@ -134,7 +134,7 @@ std::string Effect::output_convenience_uniforms() return output; } -void Effect::set_uniforms(GLhandleARB glsl_program_num, const std::string& prefix) +void Effect::set_uniforms(GLuint glsl_program_num, const std::string& prefix) { for (std::map::const_iterator it = params_float.begin(); it != params_float.end(); diff --git a/effect.h b/effect.h index f92201e..32d8f40 100644 --- a/effect.h +++ b/effect.h @@ -23,9 +23,9 @@ struct RGBTriplet { }; // Convenience functions that deal with prepending the prefix. -void set_uniform_float(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, float value); -void set_uniform_vec2(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, const float *values); -void set_uniform_vec3(GLhandleARB glsl_program_num, const std::string &prefix, const std::string &key, const float *values); +void set_uniform_float(GLuint glsl_program_num, const std::string &prefix, const std::string &key, float value); +void set_uniform_vec2(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values); +void set_uniform_vec3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values); class Effect { public: @@ -37,7 +37,7 @@ public: virtual std::string output_convenience_uniforms(); virtual std::string output_glsl() = 0; - virtual void set_uniforms(GLhandleARB glsl_program_num, const std::string& prefix); + virtual void set_uniforms(GLuint glsl_program_num, const std::string& prefix); // Neither of these take ownership. bool set_int(const std::string&, int value); diff --git a/effect_chain.cpp b/effect_chain.cpp index 623d64a..f26da07 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -176,8 +176,8 @@ void EffectChain::finalize() printf("%s\n", frag_shader.c_str()); glsl_program_num = glCreateProgram(); - GLhandleARB vs_obj = compile_shader(read_file("vs.glsl"), GL_VERTEX_SHADER); - GLhandleARB fs_obj = compile_shader(frag_shader, GL_FRAGMENT_SHADER); + GLuint vs_obj = compile_shader(read_file("vs.glsl"), GL_VERTEX_SHADER); + GLuint fs_obj = compile_shader(frag_shader, GL_FRAGMENT_SHADER); glAttachShader(glsl_program_num, vs_obj); check_error(); glAttachShader(glsl_program_num, fs_obj); diff --git a/lift_gamma_gain_effect.cpp b/lift_gamma_gain_effect.cpp index cd54773..8be3a76 100644 --- a/lift_gamma_gain_effect.cpp +++ b/lift_gamma_gain_effect.cpp @@ -22,7 +22,7 @@ std::string LiftGammaGainEffect::output_glsl() return read_file("lift_gamma_gain_effect.glsl"); } -void LiftGammaGainEffect::set_uniforms(GLhandleARB glsl_program_num, const std::string &prefix) +void LiftGammaGainEffect::set_uniforms(GLuint glsl_program_num, const std::string &prefix) { Effect::set_uniforms(glsl_program_num, prefix); diff --git a/lift_gamma_gain_effect.h b/lift_gamma_gain_effect.h index 6224934..0c42319 100644 --- a/lift_gamma_gain_effect.h +++ b/lift_gamma_gain_effect.h @@ -8,7 +8,7 @@ public: LiftGammaGainEffect(); std::string output_glsl(); - void set_uniforms(GLhandleARB glsl_program_num, const std::string &prefix); + void set_uniforms(GLuint glsl_program_num, const std::string &prefix); private: RGBTriplet lift, gamma, gain; diff --git a/util.cpp b/util.cpp index 2176786..f1b838a 100644 --- a/util.cpp +++ b/util.cpp @@ -65,9 +65,9 @@ std::string read_file(const std::string &filename) return std::string(buf, len); } -GLhandleARB compile_shader(const std::string &shader_src, GLenum type) +GLuint compile_shader(const std::string &shader_src, GLenum type) { - GLhandleARB obj = glCreateShaderObjectARB(type); + GLuint obj = glCreateShader(type); const GLchar* source[] = { shader_src.data() }; const GLint length[] = { shader_src.size() }; glShaderSource(obj, 1, source, length); diff --git a/util.h b/util.h index 498e5f2..1c2f6a6 100644 --- a/util.h +++ b/util.h @@ -15,7 +15,7 @@ void hsv2rgb(float h, float s, float v, float *r, float *g, float *b); typedef double Matrix3x3[9]; std::string read_file(const std::string &filename); -GLhandleARB compile_shader(const std::string &shader_src, GLenum type); +GLuint compile_shader(const std::string &shader_src, GLenum type); void multiply_3x3_matrices(const Matrix3x3 a, const Matrix3x3 b, Matrix3x3 result); void invert_3x3_matrix(const Matrix3x3 m, Matrix3x3 result); void print_3x3_matrix(const Matrix3x3 m); diff --git a/vignette_effect.cpp b/vignette_effect.cpp index 08dadab..8fde1f7 100644 --- a/vignette_effect.cpp +++ b/vignette_effect.cpp @@ -22,7 +22,7 @@ std::string VignetteEffect::output_glsl() return read_file("vignette_effect.glsl"); } -void VignetteEffect::set_uniforms(GLhandleARB glsl_program_num, const std::string &prefix) +void VignetteEffect::set_uniforms(GLuint glsl_program_num, const std::string &prefix) { Effect::set_uniforms(glsl_program_num, prefix); diff --git a/vignette_effect.h b/vignette_effect.h index 6caff36..cadb58c 100644 --- a/vignette_effect.h +++ b/vignette_effect.h @@ -8,7 +8,7 @@ public: VignetteEffect(); std::string output_glsl(); - void set_uniforms(GLhandleARB glsl_program_num, const std::string &prefix); + void set_uniforms(GLuint glsl_program_num, const std::string &prefix); private: Point2D center; diff --git a/widgets.cpp b/widgets.cpp index 53b0eac..a170391 100644 --- a/widgets.cpp +++ b/widgets.cpp @@ -12,7 +12,7 @@ void draw_hsv_wheel(float y, float rad, float theta, float value) { - glUseProgramObjectARB(0); + glUseProgram(0); check_error(); glActiveTexture(GL_TEXTURE0); check_error(); @@ -81,7 +81,7 @@ void draw_hsv_wheel(float y, float rad, float theta, float value) void draw_saturation_bar(float y, float saturation) { - glUseProgramObjectARB(0); + glUseProgram(0); check_error(); // value slider