diff --git a/src/gui/GLShader.cc b/src/gui/GLShader.cc index e540694..d84a036 100644 --- a/src/gui/GLShader.cc +++ b/src/gui/GLShader.cc @@ -55,4 +55,18 @@ namespace jes } return false; } + + bool GLShader::create(GLenum shader_type, PathRef path) + { + uint8_t * file; + size_t size; + if (!path->read(&file, &size)) + return false; + if (size == 0u) + return false; + + bool result = create(shader_type, (const char *)file, size); + delete[] file; + return result; + } } diff --git a/src/gui/GLShader.h b/src/gui/GLShader.h index 6ee8770..e440754 100644 --- a/src/gui/GLShader.h +++ b/src/gui/GLShader.h @@ -2,6 +2,7 @@ #define GLSHADER_H #include "jes/Ref.h" +#include "jes/Path.h" #include "gl3w.h" namespace jes @@ -12,6 +13,7 @@ namespace jes GLShader() { m_id = 0u; } ~GLShader(); bool create(GLenum shader_type, const char *source, size_t size); + bool create(GLenum shader_type, PathRef path); GLuint get_id() { return m_id; } bool valid() { return m_id > 0; } protected: