From 7e9e8913ed3bc3bbf76a623153967087fa8b19cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 9 Mar 2013 23:58:31 +0100 Subject: [PATCH] Don't spit assert in Mesh::addVertexBuffer() when it's not needed. Vertex count is needed only for more than one attribute. Also updated the assertion message to include function name. --- src/Mesh.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mesh.h b/src/Mesh.h index 4b0641879..f2a7c509c 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -592,9 +592,9 @@ class MAGNUM_EXPORT Mesh { * mesh->vertexCount(), Shaders::PhongShader::Normal()); * @endcode * - * @attention The actual vertex count must be set before calling this - * function, otherwise vertex data positions in the buffer will - * be miscalculated. + * @attention If specifying more than one attribute the actual vertex + * count must be set before calling this function. Otherwise + * vertex data positions in the buffer will be miscalculated. * @attention The buffer passed as parameter is not managed by the * mesh, you must ensure it will exist for whole lifetime of the * mesh and delete it afterwards. @@ -608,7 +608,8 @@ class MAGNUM_EXPORT Mesh { * if @extension{APPLE,vertex_array_object} is available */ template inline Mesh* addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { - CORRADE_ASSERT(_vertexCount != 0, "Mesh: vertex count must be set before binding attributes", this); + CORRADE_ASSERT(sizeof...(attributes) == 1 || _vertexCount != 0, + "Mesh::addVertexBuffer(): vertex count must be set before binding attributes", this); addVertexBufferInternal(buffer, offset, attributes...); return this;