Files
MapLibreParticleLab/src/mbgl/gl/vertex_array.cpp
2019-03-06 16:12:51 +01:00

25 lines
830 B
C++

#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/index_buffer.hpp>
#include <mbgl/gl/context.hpp>
namespace mbgl {
namespace gl {
void VertexArray::bind(Context& context,
const gfx::IndexBuffer& indexBuffer,
const AttributeBindingArray& bindings) {
context.bindVertexArray = state->vertexArray;
state->indexBuffer = reinterpret_cast<const gl::IndexBufferResource&>(*indexBuffer.resource).buffer;
state->bindings.reserve(bindings.size());
for (AttributeLocation location = 0; location < bindings.size(); ++location) {
if (state->bindings.size() <= location) {
state->bindings.emplace_back(context, AttributeLocation(location));
}
state->bindings[location] = bindings[location];
}
}
} // namespace gl
} // namespace mbgl