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);
}
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";
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 << scientific;
+ 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.
stringstream ss;
ss.imbue(locale("C"));
ss.precision(8);
+ ss << scientific;
ss << "const vec2 " << name << " = vec2(" << x << ", " << y << ");\n";
return ss.str();
}
stringstream ss;
ss.imbue(locale("C"));
ss.precision(8);
+ ss << scientific;
ss << "const vec3 " << name << " = vec3(" << x << ", " << y << ", " << z << ");\n";
return ss.str();
}