diff options
Diffstat (limited to 'gfx/gl/shader.cpp')
-rw-r--r-- | gfx/gl/shader.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index 8b0f614..5f83b83 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -3,16 +3,15 @@ #include <stdexcept> #include <string> -Shader::operator GLuint() const +Shader::ShaderRef +Shader::compile() const { - if (!shader) { - shader.emplace(type); - glShaderSource(*shader, 1, &text, &len); - glCompileShader(*shader); + ShaderRef shader {type}; + glShaderSource(shader, 1, &text, &len); + glCompileShader(shader); - CheckShaderError(*shader, GL_COMPILE_STATUS, false, "Error compiling shader!"); - } - return *shader; + CheckShaderError(shader, GL_COMPILE_STATUS, false, "Error compiling shader!"); + return shader; } void |