From 35093a5c4568b8a46aa333e5f7ecf3294bd5a3b6 Mon Sep 17 00:00:00 2001 From: vrld Date: Fri, 13 Aug 2010 18:50:00 +0200 Subject: [PATCH] Change bind/unbind to grab/stop --- .hgignore | 4 ++++ src/modules/graphics/opengl/Framebuffer.cpp | 4 ++-- src/modules/graphics/opengl/Framebuffer.h | 6 ++---- src/modules/graphics/opengl/wrap_Framebuffer.cpp | 16 ++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.hgignore b/.hgignore index 5869abae8..12c3162a3 100644 --- a/.hgignore +++ b/.hgignore @@ -7,6 +7,10 @@ glob:extra/reshax/Debug/ glob:extra/reshax/resources.h glob:extra/reshax/resources.cpp glob:*.obj +glob:*.o +glob:*.dirstamp +glob:*.m4 +glob:*.Po glob:*.dll glob:*.user glob:*.suo diff --git a/src/modules/graphics/opengl/Framebuffer.cpp b/src/modules/graphics/opengl/Framebuffer.cpp index 1e5a76401..e2adb865d 100644 --- a/src/modules/graphics/opengl/Framebuffer.cpp +++ b/src/modules/graphics/opengl/Framebuffer.cpp @@ -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(); diff --git a/src/modules/graphics/opengl/Framebuffer.h b/src/modules/graphics/opengl/Framebuffer.h index 53a9a5bc2..8b134dd5f 100644 --- a/src/modules/graphics/opengl/Framebuffer.h +++ b/src/modules/graphics/opengl/Framebuffer.h @@ -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; diff --git a/src/modules/graphics/opengl/wrap_Framebuffer.cpp b/src/modules/graphics/opengl/wrap_Framebuffer.cpp index d8c44a384..4dd669428 100644 --- a/src/modules/graphics/opengl/wrap_Framebuffer.cpp +++ b/src/modules/graphics/opengl/wrap_Framebuffer.cpp @@ -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 } };