mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Change bind/unbind to grab/stop
This commit is contained in:
@@ -89,7 +89,7 @@ namespace opengl
|
||||
status_to_string[statusCode()];
|
||||
}
|
||||
|
||||
void Framebuffer::bind()
|
||||
void Framebuffer::grab()
|
||||
{
|
||||
glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
@@ -98,7 +98,7 @@ namespace opengl
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void Framebuffer::unbind()
|
||||
void Framebuffer::stop()
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glPopAttrib();
|
||||
|
||||
@@ -24,10 +24,8 @@ namespace opengl
|
||||
GLenum statusCode() const { return status_; } //SERIOUS DISLIKE HERE
|
||||
const char* statusMessage() const;
|
||||
|
||||
void bind(); //DOUBTFUL ABOUT NAME
|
||||
void unbind(); //Maybe start/stop?
|
||||
//And what about clearing, clear() isn't entirely what I want either
|
||||
//maybe make bind/start autoclear?
|
||||
void grab();
|
||||
void stop();
|
||||
|
||||
virtual void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
|
||||
|
||||
|
||||
@@ -17,34 +17,34 @@ namespace opengl
|
||||
if (!lua_isfunction(L, 2))
|
||||
return luaL_error(L, "Need a function to render to fbo");
|
||||
|
||||
fbo->bind();
|
||||
fbo->grab();
|
||||
|
||||
lua_settop(L, 2); // make sure the function is on top of the stack
|
||||
lua_pcall(L, 0, 0, 0);
|
||||
|
||||
fbo->unbind();
|
||||
fbo->stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Framebuffer_bind(lua_State * L)
|
||||
int w_Framebuffer_grab(lua_State * L)
|
||||
{
|
||||
Framebuffer * fbo = luax_checkfbo(L, 1);
|
||||
fbo->bind();
|
||||
fbo->grab();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Framebuffer_unbind(lua_State * L)
|
||||
int w_Framebuffer_stop(lua_State * L)
|
||||
{
|
||||
Framebuffer * fbo = luax_checkfbo(L, 1);
|
||||
fbo->unbind();
|
||||
fbo->stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "render", w_Framebuffer_render },
|
||||
{ "bind", w_Framebuffer_bind },
|
||||
{ "unbind", w_Framebuffer_unbind },
|
||||
{ "grab", w_Framebuffer_grab },
|
||||
{ "stop", w_Framebuffer_stop },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user