From 4420f20a901ed1f96d9fb8f4df0148bc0bc3666d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 7 Mar 2026 12:32:55 +0000 Subject: Add glVertexArray useBuffer Wraps glVertexArrayVertexBuffer automatically getting the buffer name from the argument and deriving the stride from the container's value_type. --- game/scenary/illuminator.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'game/scenary/illuminator.cpp') diff --git a/game/scenary/illuminator.cpp b/game/scenary/illuminator.cpp index 7ab17fe..1dd0644 100644 --- a/game/scenary/illuminator.cpp +++ b/game/scenary/illuminator.cpp @@ -74,7 +74,7 @@ Illuminator::render(const SceneShader & shader, const Frustum &) const if (texture) { texture->bind(); } - glVertexArrayVertexBuffer(instanceVAO, 1, instances.bufferName(), 0, sizeof(LocationVertex)); + instanceVAO.useBuffer(1, instances); bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); } } @@ -86,17 +86,15 @@ Illuminator::lights(const SceneShader & shader) const if (const auto scount = instancesSpotLight.size()) { shader.spotLightInst.use(); glBindVertexArray(*instancesSpotLightVAO); - glVertexArrayVertexBuffer( - *instancesSpotLightVAO, 0, instancesSpotLight.bufferName(), 0, sizeof(SpotLightVertex)); - glVertexArrayVertexBuffer(*instancesSpotLightVAO, 1, instances.bufferName(), 0, sizeof(LocationVertex)); + instancesSpotLightVAO->useBuffer(0, instancesSpotLight); + instancesSpotLightVAO->useBuffer(1, instances); glDrawArraysInstanced(GL_POINTS, 0, static_cast(scount), static_cast(count)); } if (const auto pcount = instancesPointLight.size()) { shader.pointLightInst.use(); glBindVertexArray(*instancesPointLightVAO); - glVertexArrayVertexBuffer( - *instancesPointLightVAO, 0, instancesPointLight.bufferName(), 0, sizeof(PointLightVertex)); - glVertexArrayVertexBuffer(*instancesPointLightVAO, 1, instances.bufferName(), 0, sizeof(LocationVertex)); + instancesPointLightVAO->useBuffer(0, instancesPointLight); + instancesPointLightVAO->useBuffer(1, instances); glDrawArraysInstanced(GL_POINTS, 0, static_cast(pcount), static_cast(count)); } -- cgit v1.3