summaryrefslogtreecommitdiff
path: root/gfx/models
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-06 14:22:28 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-06 14:22:28 +0000
commitcf0ecc35ed114c6bf54fce9c6228d60dbba1a3b5 (patch)
tree7ad39a785511e5137859dbef6c940124182b8447 /gfx/models
parentExtend glVertexArray with VertexArrayConfigurator (diff)
downloadilt-cf0ecc35ed114c6bf54fce9c6228d60dbba1a3b5.tar.bz2
ilt-cf0ecc35ed114c6bf54fce9c6228d60dbba1a3b5.tar.xz
ilt-cf0ecc35ed114c6bf54fce9c6228d60dbba1a3b5.zip
Replace use of VertexArrayObject with glVertexArray/glBuffer DSA versions
Diffstat (limited to 'gfx/models')
-rw-r--r--gfx/models/mesh.h13
-rw-r--r--gfx/models/vertex.cpp8
2 files changed, 10 insertions, 11 deletions
diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h
index 4135a30..e78d27e 100644
--- a/gfx/models/mesh.h
+++ b/gfx/models/mesh.h
@@ -2,7 +2,6 @@
#include "config/types.h"
#include "gfx/gl/glBuffer.h"
-#include "gfx/gl/vertexArrayObject.h"
#include <gfx/gl/glVertexArray.h>
#include <glad/gl.h>
#include <ranges>
@@ -54,15 +53,15 @@ public:
return static_cast<RelativePosition3D>(v.pos);
}))}
{
- VertexArrayObject::data(vertices, m_vertexArrayBuffers[0], GL_ARRAY_BUFFER);
- VertexArrayObject::data(indices, m_vertexArrayBuffers[1], GL_ARRAY_BUFFER);
- configureVAO(m_vertexArrayObject);
+ m_vertexArrayBuffers[0].storage(vertices, 0);
+ m_vertexArrayBuffers[1].storage(indices, 0);
+ configureVAO(m_vertexArrayObject, 0);
}
- VertexArrayObject &
- configureVAO(VertexArrayObject && vao) const
+ auto
+ configureVAO(glVertexArray & vao, GLuint divisor) const
{
- return vao.addAttribsFor<V>(m_vertexArrayBuffers[0]).addIndices(m_vertexArrayBuffers[1]);
+ return vao.configure().addAttribsFor<V>(divisor, m_vertexArrayBuffers[0]).addIndices(m_vertexArrayBuffers[1]);
}
};
diff --git a/gfx/models/vertex.cpp b/gfx/models/vertex.cpp
index c144db3..dc32f72 100644
--- a/gfx/models/vertex.cpp
+++ b/gfx/models/vertex.cpp
@@ -1,10 +1,10 @@
#include "vertex.h"
-#include "gfx/gl/vertexArrayObject.h"
+#include "gfx/gl/glVertexArray.h"
template<>
-VertexArrayObject &
-VertexArrayObject::addAttribsFor<Vertex>(const GLuint arrayBuffer, const GLuint divisor)
+Impl::VertexArrayConfigurator &
+Impl::VertexArrayConfigurator::addAttribsFor<Vertex>(const GLuint divisor, const glBuffer & buffer)
{
return addAttribs<Vertex, &Vertex::pos, &Vertex::texCoord, &Vertex::normal, &Vertex::colour, &Vertex::material>(
- arrayBuffer, divisor);
+ divisor, buffer);
}