mirror of https://github.com/axmolengine/axmol.git
closed issue #2386 : Fix bug : add a new method to clear the stencil buffer bit used by ClippingNode
This commit is contained in:
parent
c545f6d56c
commit
010a33c009
|
@ -142,6 +142,24 @@ void ClippingNode::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()
|
||||
{
|
||||
// if stencil buffer disabled
|
||||
|
@ -256,7 +274,7 @@ void ClippingNode::visit()
|
|||
|
||||
// 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()->getWinSize()), Color4F(1, 1, 1, 1));
|
||||
drawFullScreenQuadClearStencil();
|
||||
|
||||
///////////////////////////////////
|
||||
// DRAW CLIPPING STENCIL
|
||||
|
|
|
@ -94,6 +94,11 @@ public:
|
|||
bool isInverted() const;
|
||||
void setInverted(bool bInverted);
|
||||
|
||||
private:
|
||||
/**draw fullscreen quad to clear stencil bits
|
||||
*/
|
||||
void drawFullScreenQuadClearStencil();
|
||||
|
||||
private:
|
||||
ClippingNode();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue