Add framebuffer filter modes (issue #112)

This commit is contained in:
vrld
2011-01-01 19:42:59 +01:00
parent 618d48ce39
commit 9dad948263
4 changed files with 75 additions and 2 deletions
@@ -41,9 +41,43 @@ namespace opengl
return 1;
}
int w_Framebuffer_setFilter(lua_State * L)
{
Framebuffer * fbo = luax_checkfbo(L, 1);
const char * minstr = luaL_checkstring(L, 2);
const char * magstr = luaL_checkstring(L, 3);
Image::Filter f;
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);
fbo->setFilter(f);
return 0;
}
int w_Framebuffer_getFilter(lua_State * L)
{
Framebuffer * fbo = luax_checkfbo(L, 1);
Image::Filter f = fbo->getFilter();
const char * minstr;
const char * magstr;
Image::getConstant(f.min, minstr);
Image::getConstant(f.mag, magstr);
lua_pushstring(L, minstr);
lua_pushstring(L, magstr);
return 2;
}
static const luaL_Reg functions[] = {
{ "renderTo", w_Framebuffer_renderTo },
{ "getImageData", w_Framebuffer_getImageData },
{ "setFilter", w_Framebuffer_setFilter },
{ "getFilter", w_Framebuffer_getFilter },
{ 0, 0 }
};