Skip to content

Commit

Permalink
use std::vector::data() when setting GL data
Browse files Browse the repository at this point in the history
MSVC in Debug will throw "vector subscript out of range" error when calling `std::vector::operator[]` on empty vector. This will fail unit tests. Instead use `std::vector::data()` to retrieve data pointer.
  • Loading branch information
gkoulin authored and nmwsharp committed Oct 2, 2024
1 parent 63c0962 commit 9f97b70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/render/opengl/gl_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void GLAttributeBuffer::setData_helper(const std::vector<T>& data) {

// do the actual copy
dataSize = data.size();
glBufferSubData(getTarget(), 0, dataSize * sizeof(T), &data[0]);
glBufferSubData(getTarget(), 0, dataSize * sizeof(T), data.data());

checkGLError();
}
Expand Down

0 comments on commit 9f97b70

Please sign in to comment.