add GLShader::create() which takes a PathRef
This commit is contained in:
parent
d54e772803
commit
5558eec534
@ -55,4 +55,18 @@ namespace jes
|
|||||||
}
|
}
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define GLSHADER_H
|
#define GLSHADER_H
|
||||||
|
|
||||||
#include "jes/Ref.h"
|
#include "jes/Ref.h"
|
||||||
|
#include "jes/Path.h"
|
||||||
#include "gl3w.h"
|
#include "gl3w.h"
|
||||||
|
|
||||||
namespace jes
|
namespace jes
|
||||||
@ -12,6 +13,7 @@ namespace jes
|
|||||||
GLShader() { m_id = 0u; }
|
GLShader() { m_id = 0u; }
|
||||||
~GLShader();
|
~GLShader();
|
||||||
bool create(GLenum shader_type, const char *source, size_t size);
|
bool create(GLenum shader_type, const char *source, size_t size);
|
||||||
|
bool create(GLenum shader_type, PathRef path);
|
||||||
GLuint get_id() { return m_id; }
|
GLuint get_id() { return m_id; }
|
||||||
bool valid() { return m_id > 0; }
|
bool valid() { return m_id > 0; }
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user