Revise spritebatch locking (binding now) (issue #231)

This commit is contained in:
Bart van Strien
2011-06-10 14:40:37 +02:00
parent fafe0d7039
commit bd158faaaa
2 changed files with 8 additions and 6 deletions
@@ -161,11 +161,13 @@ namespace opengl
glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
lockp = (vertex *)glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
glBindBuffer(GL_ARRAY_BUFFER, 0);
return lockp;
}
void SpriteBatch::unlock()
{
glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);
glUnmapBuffer(GL_ARRAY_BUFFER);
lockp = 0;
glBindBuffer(GL_ARRAY_BUFFER, 0);
@@ -67,14 +67,14 @@ namespace opengl
return 0;
}
int w_SpriteBatch_lock(lua_State * L)
int w_SpriteBatch_bind(lua_State * L)
{
SpriteBatch * t = luax_checkspritebatch(L, 1);
lua_pushlightuserdata(L, t->lock());
return 1;
t->lock();
return 0;
}
int w_SpriteBatch_unlock(lua_State * L)
int w_SpriteBatch_unbind(lua_State * L)
{
SpriteBatch * t = luax_checkspritebatch(L, 1);
t->unlock();
@@ -93,8 +93,8 @@ namespace opengl
{ "add", w_SpriteBatch_add },
{ "addq", w_SpriteBatch_addq },
{ "clear", w_SpriteBatch_clear },
{ "lock", w_SpriteBatch_lock },
{ "unlock", w_SpriteBatch_unlock },
{ "bind", w_SpriteBatch_bind },
{ "unbind", w_SpriteBatch_unbind },
{ "setImage", w_SpriteBatch_setImage },
{ 0, 0 }
};