summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/gl/glSource.h2
-rw-r--r--gfx/gl/programHandle.h2
-rw-r--r--lib/glRef.hpp6
3 files changed, 5 insertions, 5 deletions
diff --git a/gfx/gl/glSource.h b/gfx/gl/glSource.h
index e44c5a2..7b43c48 100644
--- a/gfx/gl/glSource.h
+++ b/gfx/gl/glSource.h
@@ -6,7 +6,7 @@
#include <string_view>
struct GLsource {
- using ShaderRef = glRef<GLuint, __glewCreateShader, __glewDeleteShader>;
+ using ShaderRef = glRef<GLuint, &__glewCreateShader, &__glewDeleteShader>;
const GLchar * text;
GLint len;
diff --git a/gfx/gl/programHandle.h b/gfx/gl/programHandle.h
index 6aa1084..5bd5c05 100644
--- a/gfx/gl/programHandle.h
+++ b/gfx/gl/programHandle.h
@@ -7,7 +7,7 @@
class ProgramHandleBase {
public:
ProgramHandleBase(GLuint, GLuint);
- using ProgramRef = glRef<GLuint, __glewCreateProgram, __glewDeleteProgram>;
+ using ProgramRef = glRef<GLuint, &__glewCreateProgram, &__glewDeleteProgram>;
ProgramRef m_program;
GLint viewProjection_uniform, model_uniform;
diff --git a/lib/glRef.hpp b/lib/glRef.hpp
index 8596bd3..b33980d 100644
--- a/lib/glRef.hpp
+++ b/lib/glRef.hpp
@@ -4,9 +4,9 @@
#include <special_members.hpp>
#include <stdexcept>
-template<typename IdType, auto & get, auto & release, auto... fixed> class glRef {
+template<typename IdType, auto get, auto release, auto... fixed> class glRef {
public:
- template<typename... Args> explicit glRef(Args &&... args) : id {get(fixed..., std::forward<Args>(args)...)}
+ template<typename... Args> explicit glRef(Args &&... args) : id {(*get)(fixed..., std::forward<Args>(args)...)}
{
if (!id) {
throw std::runtime_error("Get function failed");
@@ -21,7 +21,7 @@ public:
~glRef()
{
if (id) {
- release(id);
+ (*release)(id);
}
}