X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=util.cpp;h=0a294e65ca7a8ab07a77ab1438286038848ea7a2;hb=71cf8dc668a86a14ea73c6bc442391996fe247cc;hp=3ebf162d31a0558ddfb54d3a8520706035ee45e6;hpb=0cea318493ae406e5fff6e10eb8d3e171603a0c0;p=movit diff --git a/util.cpp b/util.cpp index 3ebf162..0a294e6 100644 --- a/util.cpp +++ b/util.cpp @@ -156,6 +156,7 @@ GLuint compile_shader(const string &shader_src, GLenum type) GLint status; glGetShaderiv(obj, GL_COMPILE_STATUS, &status); if (status == GL_FALSE) { + fprintf(stderr, "Failed to compile shader: %s\n", shader_src.c_str()); exit(1); } @@ -183,6 +184,16 @@ string output_glsl_mat3(const string &name, const Eigen::Matrix3d &m) return ss.str(); } +string output_glsl_float(const string &name, float x) +{ + // Use stringstream to be independent of the current locale in a thread-safe manner. + stringstream ss; + ss.imbue(locale("C")); + ss.precision(8); + ss << "const float " << name << " = " << x << ";\n"; + return ss.str(); +} + string output_glsl_vec2(const string &name, float x, float y) { // Use stringstream to be independent of the current locale in a thread-safe manner.