summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 12:32:55 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 14:17:44 +0000
commit4420f20a901ed1f96d9fb8f4df0148bc0bc3666d (patch)
treeb6484d3a75acb1c9461707d2c7168fa5b652b15c /gfx/gl
parentDon't create and then replace shadow and billboard textures (diff)
downloadilt-4420f20a901ed1f96d9fb8f4df0148bc0bc3666d.tar.bz2
ilt-4420f20a901ed1f96d9fb8f4df0148bc0bc3666d.tar.xz
ilt-4420f20a901ed1f96d9fb8f4df0148bc0bc3666d.zip
Add glVertexArray useBuffer
Wraps glVertexArrayVertexBuffer automatically getting the buffer name from the argument and deriving the stride from the container's value_type.
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/glVertexArray.h11
-rw-r--r--gfx/gl/instanceVertices.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/gfx/gl/glVertexArray.h b/gfx/gl/glVertexArray.h
index 3594cbf..3790863 100644
--- a/gfx/gl/glVertexArray.h
+++ b/gfx/gl/glVertexArray.h
@@ -115,6 +115,17 @@ namespace Impl {
{
return VertexArrayConfigurator {name};
}
+
+ template<typename GlAllocated>
+ void
+ useBuffer(GLuint binding, const GlAllocated & buffer) const
+ requires requires {
+ { buffer.bufferName() } -> std::same_as<GLuint>;
+ }
+ {
+ using T = typename GlAllocated::value_type;
+ glVertexArrayVertexBuffer(name, binding, buffer.bufferName(), 0, sizeof(T));
+ }
};
}
diff --git a/gfx/gl/instanceVertices.h b/gfx/gl/instanceVertices.h
index f24eaa3..2643e68 100644
--- a/gfx/gl/instanceVertices.h
+++ b/gfx/gl/instanceVertices.h
@@ -126,6 +126,8 @@ public:
return base::get_allocator().getNameFor(static_cast<const base &>(*this));
}
+ using base::value_type;
+
using base::at;
using base::begin;
using base::cbegin;