diff --git a/doc/changelog.dox b/doc/changelog.dox index a923a7ad5..bbb3cb75f 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -170,6 +170,10 @@ See also: @subsection changelog-latest-bugfixes Bug fixes +- The variadic versions of @ref GL::Mesh::addVertexBuffer() and + @ref GL::Mesh::addVertexBufferInstanced() were sometimes errorneously + picked up instead of the @ref GL::DynamicAttribute overloads when stride + and offset were of a slightly different type. - @ref Platform::Sdl2Application::viewportEvent() gets properly fired also when window size changes programmatically (such as through @ref Platform::Sdl2Application::setMinWindowSize() "setMinWindowSize()") diff --git a/src/Magnum/GL/Mesh.h b/src/Magnum/GL/Mesh.h index 966849b95..a04d121fa 100644 --- a/src/Magnum/GL/Mesh.h +++ b/src/Magnum/GL/Mesh.h @@ -171,7 +171,14 @@ enum class MeshIndexType: GLenum { */ MAGNUM_GL_EXPORT MeshIndexType meshIndexType(Magnum::MeshIndexType type); -namespace Implementation { struct MeshState; } +namespace Implementation { + +struct MeshState; + +template struct IsDynamicAttribute: std::false_type {}; +template struct IsDynamicAttribute: std::true_type {}; + +} /** @brief Mesh @@ -688,7 +695,12 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject { * This is not required anywhere else, but doing so may have * performance benefits. */ - template inline Mesh& addVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes) { + template::value>::type + #endif + > Mesh& addVertexBuffer(Buffer& buffer, GLintptr offset, const T&... attributes) { addVertexBufferInternal(buffer, offset, strideOfInterleaved(attributes...), 0, attributes...); return *this; } @@ -724,7 +736,12 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject { * @requires_webgl20 Extension @webgl_extension{ANGLE,instanced_arrays} * in WebGL 1.0. */ - template inline Mesh& addVertexBufferInstanced(Buffer& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) { + template::value>::type + #endif + > inline Mesh& addVertexBufferInstanced(Buffer& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) { addVertexBufferInternal(buffer, offset, strideOfInterleaved(attributes...), divisor, attributes...); return *this; } @@ -763,7 +780,12 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject { * this function takes ownership of @p buffer. See * @ref GL-Mesh-buffer-ownership for more information. */ - template inline Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, const T&... attributes) { + template::value>::type + #endif + > inline Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, const T&... attributes) { addVertexBuffer(buffer, offset, attributes...); acquireVertexBuffer(std::move(buffer)); return *this; @@ -777,7 +799,12 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject { * this function takes ownership of @p buffer. See * @ref GL-Mesh-buffer-ownership for more information. */ - template inline Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) { + template::value>::type + #endif + > inline Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) { addVertexBufferInstanced(buffer, divisor, offset, attributes...); acquireVertexBuffer(std::move(buffer)); return *this;