Browse Source

Allow attribute-less Mesh.

For e.g. fullscreen triangle with no vertex data.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
8f13362f7a
  1. 2
      src/Mesh.cpp
  2. 5
      src/Mesh.h

2
src/Mesh.cpp

@ -111,7 +111,7 @@ void Mesh::bindVAO(GLuint vao) {
} }
void Mesh::bind() { void Mesh::bind() {
CORRADE_ASSERT((_vertexCount == 0) == attributes.empty(), "Mesh: vertex count is non-zero, but no attributes are bound", ); CORRADE_ASSERT((_vertexCount != 0) || !attributes.empty(), "Mesh: attributes are bound but vertex count is zero", );
(this->*bindImplementation)(); (this->*bindImplementation)();
} }

5
src/Mesh.h

@ -404,8 +404,9 @@ class MAGNUM_EXPORT Mesh {
* *
* Default is zero. * Default is zero.
* @attention All bound attributes are reset after calling this * @attention All bound attributes are reset after calling this
* function, so you must call * function, so if your mesh has any vertex attributes, be sure
* addVertexBuffer()/addInterleavedVertexBuffer() afterwards. * to call addVertexBuffer()/addInterleavedVertexBuffer()
* afterwards.
* @see MeshTools::interleave() * @see MeshTools::interleave()
*/ */
Mesh* setVertexCount(GLsizei vertexCount); Mesh* setVertexCount(GLsizei vertexCount);

Loading…
Cancel
Save