summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/glVertexArray.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/gfx/gl/glVertexArray.h b/gfx/gl/glVertexArray.h
index 6630b70..791f74f 100644
--- a/gfx/gl/glVertexArray.h
+++ b/gfx/gl/glVertexArray.h
@@ -125,13 +125,33 @@ namespace Impl {
template<typename glAllocated>
void
- useBuffer(GLuint binding, const glAllocated & buffer) const
+ useBuffer(GLuint binding, const glAllocated & buffer, GLsizei offset = 0) const
requires requires {
{ buffer.bufferName() } -> std::same_as<GLuint>;
}
{
using T = typename glAllocated::value_type;
- glVertexArrayVertexBuffer(name, binding, buffer.bufferName(), 0, sizeof(T));
+ useBuffer(binding, buffer.bufferName(), sizeof(T), offset);
+ }
+
+ template<typename V>
+ void
+ useBuffer(GLuint binding, GLuint bufferName, auto V::* mbr) const
+ {
+ useBuffer(binding, bufferName, sizeof(V), VertexArrayConfigurator::MP {mbr});
+ }
+
+ template<typename V>
+ void
+ useBuffer(GLuint binding, GLuint bufferName, GLintptr offset = 0) const
+ {
+ useBuffer(binding, bufferName, sizeof(V), offset);
+ }
+
+ void
+ useBuffer(GLuint binding, GLuint bufferName, GLsizei stride, GLintptr offset = 0) const
+ {
+ glVertexArrayVertexBuffer(name, binding, bufferName, offset, stride);
}
};
}