mirror of
https://github.com/allemangD/toddcox-visualize.git
synced 2025-11-10 12:02:47 -05:00
embed shaders in binary
This commit is contained in:
@@ -23,6 +23,17 @@ public:
|
||||
// todo throw if compile failed
|
||||
}
|
||||
|
||||
explicit Shader(const std::string_view &src) {
|
||||
id = glCreateShader(mode);
|
||||
|
||||
const char *str = src.data();
|
||||
const GLint length = (GLint) src.length();
|
||||
glShaderSource(id, 1, &str, &length);
|
||||
glCompileShader(id);
|
||||
|
||||
// todo throw if compile failed
|
||||
}
|
||||
|
||||
explicit Shader(std::ifstream source)
|
||||
: Shader(std::string(
|
||||
std::istreambuf_iterator<char>(source),
|
||||
|
||||
Reference in New Issue
Block a user