X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=util.cpp;h=e266fb813921e606abd95a374f0a5772c0fd1edb;hp=a6175b4dbaf81bcad6fe7d9b6b585a4b2a3b76b6;hb=9faecb6aed1b84c71286b30b6600ef5e4ee76537;hpb=ba60914d4e5eda7b28af700bf43e9699b7aa720d diff --git a/util.cpp b/util.cpp index a6175b4..e266fb8 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); } @@ -176,6 +177,7 @@ string output_glsl_mat3(const string &name, const Eigen::Matrix3d &m) stringstream ss; ss.imbue(locale("C")); ss.precision(8); + ss << scientific; ss << "const mat3 " << name << " = mat3(\n"; ss << " " << m(0,0) << ", " << m(1,0) << ", " << m(2,0) << ",\n"; ss << " " << m(0,1) << ", " << m(1,1) << ", " << m(2,1) << ",\n"; @@ -189,6 +191,7 @@ string output_glsl_float(const string &name, float x) stringstream ss; ss.imbue(locale("C")); ss.precision(8); + ss << scientific; ss << "const float " << name << " = " << x << ";\n"; return ss.str(); } @@ -199,6 +202,7 @@ string output_glsl_vec2(const string &name, float x, float y) stringstream ss; ss.imbue(locale("C")); ss.precision(8); + ss << scientific; ss << "const vec2 " << name << " = vec2(" << x << ", " << y << ");\n"; return ss.str(); } @@ -209,6 +213,7 @@ string output_glsl_vec3(const string &name, float x, float y, float z) stringstream ss; ss.imbue(locale("C")); ss.precision(8); + ss << scientific; ss << "const vec3 " << name << " = vec3(" << x << ", " << y << ", " << z << ");\n"; return ss.str(); }