Add framebuffer:clear(r,g,b,a) (issue #134).

--HG--
branch : minor
This commit is contained in:
vrld
2011-03-12 15:43:00 +01:00
parent 141d4d5eee
commit 19e4dea8e8
4 changed files with 58 additions and 0 deletions
@@ -1,4 +1,5 @@
#include "Framebuffer.h"
#include "Graphics.h"
#include <common/Matrix.h>
#include <cstring> // For memcpy
@@ -233,6 +234,22 @@ namespace opengl
current = NULL;
}
void Framebuffer::clear(const Color& c)
{
GLuint previous = 0;
if (current != NULL)
previous = current->fbo;
strategy->bindFBO(fbo);
glPushAttrib(GL_COLOR_BUFFER_BIT);
glClearColor((float)c.r/255.0f, (float)c.g/255.0f, (float)c.b/255.0f, (float)c.a/255.0f);
glClear(GL_COLOR_BUFFER_BIT);
glPopAttrib();
strategy->bindFBO(previous);
}
void Framebuffer::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
{
static Matrix t;