Skip to content

Commit 9f97b70

Browse files
gkoulinnmwsharp
authored andcommitted
use std::vector::data() when setting GL data
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.
1 parent 63c0962 commit 9f97b70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/render/opengl/gl_engine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void GLAttributeBuffer::setData_helper(const std::vector<T>& data) {
264264

265265
// do the actual copy
266266
dataSize = data.size();
267-
glBufferSubData(getTarget(), 0, dataSize * sizeof(T), &data[0]);
267+
glBufferSubData(getTarget(), 0, dataSize * sizeof(T), data.data());
268268

269269
checkGLError();
270270
}

0 commit comments

Comments
 (0)