Skip to content

Commit

Permalink
Fixed|libgui|GLBuffer: Buffer not ready with an empty buffer
Browse files Browse the repository at this point in the history
If an empty buffer is defined, it is still valid for drawing. A buffer
needs to be cleared (released) to really be a "not ready" asset.
  • Loading branch information
skyjake committed Jul 31, 2013
1 parent 02a52ee commit 6ba1f8c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doomsday/libgui/src/glbuffer.cpp
Expand Up @@ -192,13 +192,16 @@ void GLBuffer::setVertices(Primitive primitive, dsize count, void const *data, d
d->prim = primitive;
d->count = count;

if(data && dataSize && count)
if(data)
{
d->alloc();

glBindBuffer(GL_ARRAY_BUFFER, d->name);
glBufferData(GL_ARRAY_BUFFER, dataSize, data, Instance::glUsage(usage));
glBindBuffer(GL_ARRAY_BUFFER, 0);
if(dataSize && count)
{
glBindBuffer(GL_ARRAY_BUFFER, d->name);
glBufferData(GL_ARRAY_BUFFER, dataSize, data, Instance::glUsage(usage));
glBindBuffer(GL_ARRAY_BUFFER, 0);
}

setState(Ready);
}
Expand Down

0 comments on commit 6ba1f8c

Please sign in to comment.