shader builders

This commit is contained in:
2018-12-11 02:02:53 -05:00
parent abf32feb0d
commit aad1854d7e
7 changed files with 165 additions and 39 deletions

View File

@@ -0,0 +1,28 @@
#ifndef GL_TEMPLATE_RESOURCE_H
#define GL_TEMPLATE_RESOURCE_H
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
std::string readFile(const std::string &path) {
std::ifstream file(path);
if (!file) return std::string();
file.ignore(std::numeric_limits<std::streamsize>::max());
auto size = file.gcount();
if (size > 0x10000) return std::string();
file.clear();
file.seekg(0, std::ios_base::beg);
std::stringstream sstr;
sstr << file.rdbuf();
file.close();
return sstr.str();
}
#endif //GL_TEMPLATE_RESOURCE_H