diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-07 12:32:55 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-07 14:17:44 +0000 |
| commit | 4420f20a901ed1f96d9fb8f4df0148bc0bc3666d (patch) | |
| tree | b6484d3a75acb1c9461707d2c7168fa5b652b15c /game/scenary/foliage.cpp | |
| parent | Don't create and then replace shadow and billboard textures (diff) | |
| download | ilt-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 'game/scenary/foliage.cpp')
| -rw-r--r-- | game/scenary/foliage.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp index 4e10ed9..edfb0e9 100644 --- a/game/scenary/foliage.cpp +++ b/game/scenary/foliage.cpp @@ -102,7 +102,7 @@ Foliage::render(const SceneShader & shader, const Frustum &) const billboard[1].bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE1); billboard[2].bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE2); glBindVertexArray(instancePointVAO); - glVertexArrayVertexBuffer(instancePointVAO, 0, instances.bufferName(), 0, sizeof(LocationVertex)); + instancePointVAO.useBuffer(0, instances); glDrawArrays(GL_POINTS, static_cast<GLint>(instancePartitions.second.first), static_cast<GLsizei>(count)); glBindVertexArray(0); } @@ -112,7 +112,7 @@ Foliage::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<GLsizei>(count)); } } @@ -129,7 +129,7 @@ Foliage::shadows(const ShadowMapper & mapper, const Frustum &) const mapper.stencilShadowProgram.use(dimensions.centre, dimensions.size); shadowStencil.bind(GL_TEXTURE_2D_ARRAY, GL_TEXTURE0); glBindVertexArray(instancePointVAO); - glVertexArrayVertexBuffer(instancePointVAO, 0, instances.bufferName(), 0, sizeof(LocationVertex)); + instancePointVAO.useBuffer(0, instances); glDrawArrays(GL_POINTS, static_cast<GLint>(instancePartitions.second.first), static_cast<GLsizei>(count)); glBindVertexArray(0); } @@ -141,7 +141,7 @@ Foliage::shadows(const ShadowMapper & mapper, const Frustum &) const else { mapper.dynamicPointInst.use(); } - glVertexArrayVertexBuffer(instanceVAO, 1, instances.bufferName(), 0, sizeof(LocationVertex)); + instanceVAO.useBuffer(1, instances); bodyMesh->DrawInstanced(instanceVAO, static_cast<GLsizei>(count)); } } |
