Browse Source

GL: properly reset vertex divisor after drawing w/o a VAO.

Otherwise it messes up subsequent draws.
pull/255/head
Vladimír Vondruš 8 years ago
parent
commit
9275613006
  1. 3
      doc/changelog.dox
  2. 12
      src/Magnum/GL/Mesh.cpp

3
doc/changelog.dox

@ -98,6 +98,9 @@ See also:
due to a pointer not being properly initialized after the
@ref Platform::GlfwApplication::GLConfiguration "GLConfiguration" rework in
2018.04 (see [mosra/magnum#246](https://github.com/mosra/magnum/pull/246))
- Vertex attribute divisor in @ref GL::Mesh::addVertexBufferInstanced() was
not properly cleaned up after when @gl_extension{ARB,vertex_array_object}
was disabled, causing subsequent draws to misbehave
@subsection changelog-latest-deprecated Deprecated APIs

12
src/Magnum/GL/Mesh.cpp

@ -746,8 +746,18 @@ void Mesh::bindImplementationVAO() {
}
void Mesh::unbindImplementationDefault() {
for(const AttributeLayout& attribute: *reinterpret_cast<std::vector<AttributeLayout>*>(&_attributes))
for(const AttributeLayout& attribute: *reinterpret_cast<std::vector<AttributeLayout>*>(&_attributes)) {
glDisableVertexAttribArray(attribute.location);
/* Reset also the divisor back so it doesn't affect */
if(attribute.divisor) {
#ifndef MAGNUM_TARGET_GLES2
glVertexAttribDivisor(attribute.location, 0);
#else
(this->*Context::current().state().mesh->vertexAttribDivisorImplementation)(attribute.location, 0);
#endif
}
}
}
void Mesh::unbindImplementationVAO() {}

Loading…
Cancel
Save