closed issue #2386 : Fix bug : add a new method to clear the stencil buffer bit used by ClippingNode

This commit is contained in:
Huabing.Xu 2013-07-10 15:33:43 +08:00
parent c545f6d56c
commit 010a33c009
2 changed files with 24 additions and 1 deletions

View File

@ -142,6 +142,24 @@ void ClippingNode::onExit()
Node::onExit(); Node::onExit();
} }
void ClippingNode::drawFullScreenQuadClearStencil()
{
kmGLMatrixMode(KM_GL_MODELVIEW);
kmGLPushMatrix();
kmGLLoadIdentity();
kmGLMatrixMode(KM_GL_PROJECTION);
kmGLPushMatrix();
kmGLLoadIdentity();
ccDrawSolidRect(ccp(-1,-1), ccp(1,1), Color4F(1, 1, 1, 1));
kmGLMatrixMode(KM_GL_PROJECTION);
kmGLPopMatrix();
kmGLMatrixMode(KM_GL_MODELVIEW);
kmGLPopMatrix();
}
void ClippingNode::visit() void ClippingNode::visit()
{ {
// if stencil buffer disabled // if stencil buffer disabled
@ -256,7 +274,7 @@ void ClippingNode::visit()
// draw a fullscreen solid rectangle to clear the stencil buffer // draw a fullscreen solid rectangle to clear the stencil buffer
//ccDrawSolidRect(PointZero, ccpFromSize([[Director sharedDirector] winSize]), Color4F(1, 1, 1, 1)); //ccDrawSolidRect(PointZero, ccpFromSize([[Director sharedDirector] winSize]), Color4F(1, 1, 1, 1));
ccDrawSolidRect(PointZero, ccpFromSize(Director::sharedDirector()->getWinSize()), Color4F(1, 1, 1, 1)); drawFullScreenQuadClearStencil();
/////////////////////////////////// ///////////////////////////////////
// DRAW CLIPPING STENCIL // DRAW CLIPPING STENCIL

View File

@ -94,6 +94,11 @@ public:
bool isInverted() const; bool isInverted() const;
void setInverted(bool bInverted); void setInverted(bool bInverted);
private:
/**draw fullscreen quad to clear stencil bits
*/
void drawFullScreenQuadClearStencil();
private: private:
ClippingNode(); ClippingNode();
}; };