Moved shaders to standalone source file

This commit is contained in:
Pablo Rodriguez
2025-07-28 05:22:56 -04:00
parent 6d8bf7c563
commit 9a38c557f0
5 changed files with 38 additions and 32 deletions

View File

@@ -46,10 +46,10 @@ ugly::ShaderProgramBuilder &ugly::ShaderProgramBuilder::attachFromMemory(GLenum
ugly::ShaderProgramBuilder &ugly::ShaderProgramBuilder::attachFromFile(GLenum type, const char *filename) {
auto file = std::ifstream{filename};
file.exceptions(std::ios_base::badbit);
std::ostringstream ss;
ss << file.rdbuf();
auto file = std::filebuf{};
auto ss = std::ostringstream{};
ss.exceptions(std::ios_base::badbit);
ss << file.open(filename, std::ios_base::in);
return attachFromMemory(type, ss.str().c_str());
}
@@ -63,7 +63,7 @@ GLuint ugly::ShaderProgramBuilder::link() {
char buf[512];
glGetProgramInfoLog(mProgram, 512, NULL, buf);
std::cerr << "Failed to link program:\n\t" << buf << '\n';
throw Error{"program failed to link"};
throw Error{"program failed to link"};
}
auto result = mProgram;