1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

fixed double-vertexbuffer issues

This commit is contained in:
Zeno Rogue 2018-02-20 21:11:32 +01:00
parent 59eb2bfd75
commit 6080e96b99

View File

@ -552,7 +552,7 @@ struct ct_vertex {
#if CAP_VERTEXBUFFER
template<class T> void bindbuffer(T& v) {
if(current_vertices == buffered_vertices) {
if(current_vertices == buffered_vertices || current_vertices == nullptr) {
glBindBuffer(GL_ARRAY_BUFFER, buf_current);
}
current_vertices = &v[0];
@ -570,7 +570,6 @@ void vertices(const vector<glvertex>& v) {
if(&v[0] == current_vertices) return;
current_vertices = buffered_vertices;
glBindBuffer(GL_ARRAY_BUFFER, buf_buffered);
glBufferData(GL_ARRAY_BUFFER, size(v) * sizeof(v[0]), &v[0], GL_STATIC_DRAW);
glVertexAttribPointer(glhr::aPosition, 3, GL_FLOAT, GL_FALSE, sizeof(glvertex), 0);
return;
}