Merge Framebuffer changes

This commit is contained in:
vrld
2011-03-12 14:30:21 +01:00
2 changed files with 37 additions and 1 deletions
@@ -51,7 +51,7 @@ namespace opengl
if (!Image::getConstant(minstr, f.min))
return luaL_error(L, "Invalid min filter mode: %s", minstr);
if (!Image::getConstant(magstr, f.mag))
return luaL_error(L, "Invalid max filter mode: %s", minstr);
return luaL_error(L, "Invalid max filter mode: %s", magstr);
fbo->setFilter(f);
return 0;
@@ -73,11 +73,45 @@ namespace opengl
return 2;
}
int w_Framebuffer_setWrap(lua_State * L)
{
Framebuffer * fbo = luax_checkfbo(L, 1);
const char * wrap_s = luaL_checkstring(L, 2);
const char * wrap_t = luaL_checkstring(L, 3);
Image::Wrap w;
if (!Image::getConstant(wrap_s, w.s))
return luaL_error(L, "Invalid wrap mode: %s", wrap_s);
if (!Image::getConstant(wrap_t, w.t))
return luaL_error(L, "Invalid wrap mode: %s", wrap_t);
fbo->setWrap(w);
return 0;
}
int w_Framebuffer_getWrap(lua_State * L)
{
Framebuffer * fbo = luax_checkfbo(L, 1);
Image::Wrap w = fbo->getWrap();
const char * wrap_s;
const char * wrap_t;
Image::getConstant(w.s, wrap_s);
Image::getConstant(w.t, wrap_t);
lua_pushstring(L, wrap_s);
lua_pushstring(L, wrap_t);
return 2;
}
static const luaL_Reg functions[] = {
{ "renderTo", w_Framebuffer_renderTo },
{ "getImageData", w_Framebuffer_getImageData },
{ "setFilter", w_Framebuffer_setFilter },
{ "getFilter", w_Framebuffer_getFilter },
{ "setWrap", w_Framebuffer_setWrap },
{ "getWrap", w_Framebuffer_getWrap },
{ 0, 0 }
};
@@ -17,6 +17,8 @@ namespace opengl
int w_Framebuffer_getImageData(lua_State * L);
int w_Framebuffer_setFilter(lua_State * L);
int w_Framebuffer_getFilter(lua_State * L);
int w_Framebuffer_setWrap(lua_State * L);
int w_Framebuffer_getWrap(lua_State * L);
int luaopen_framebuffer(lua_State * L);
} // opengl