1. remove redundant code in NewRenderTexture 2. rename protected beginWithClear to _beginWithClear

This commit is contained in:
Huabing.Xu 2013-12-23 14:59:44 +08:00
parent b5976b1a51
commit b7c0d7a9e8
4 changed files with 8 additions and 27 deletions

View File

@ -339,20 +339,20 @@ void RenderTexture::begin()
void RenderTexture::beginWithClear(float r, float g, float b, float a)
{
beginWithClear(r, g, b, a, 0, 0, GL_COLOR_BUFFER_BIT);
_beginWithClear(r, g, b, a, 0, 0, GL_COLOR_BUFFER_BIT);
}
void RenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue)
{
beginWithClear(r, g, b, a, depthValue, 0, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
_beginWithClear(r, g, b, a, depthValue, 0, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
void RenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue)
{
beginWithClear(r, g, b, a, depthValue, stencilValue, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
_beginWithClear(r, g, b, a, depthValue, stencilValue, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
}
void RenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags)
void RenderTexture::_beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags)
{
this->begin();

View File

@ -164,7 +164,7 @@ public:
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat format, GLuint depthStencilFormat);
protected:
virtual void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
virtual void _beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
GLuint _FBO;
GLuint _depthRenderBufffer;

View File

@ -98,22 +98,7 @@ void NewRenderTexture::draw()
}
}
void NewRenderTexture::beginWithClear(float r, float g, float b, float a)
{
beginWithClear(r, g, b, a, 0, 0, GL_COLOR_BUFFER_BIT);
}
void NewRenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue)
{
beginWithClear(r, g, b, a, depthValue, 0, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
void NewRenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue)
{
beginWithClear(r, g, b, a, depthValue, stencilValue, GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
}
void NewRenderTexture::beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags)
void NewRenderTexture::_beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags)
{
setClearColor(Color4F(r, g, b, a));

View File

@ -36,17 +36,13 @@ public:
static NewRenderTexture* create(int w, int h, Texture2D::PixelFormat eFormat);
static NewRenderTexture* create(int w, int h);
void beginWithClear(float r, float g, float b, float a);
void beginWithClear(float r, float g, float b, float a, float depthValue);
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue);
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
virtual void begin() override;
virtual void end() override;
virtual void draw() override;
void clearDepth(float depthValue);
protected:
virtual void _beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags) override;
protected:
NewRenderTexture();
virtual ~NewRenderTexture();