CCClippingNode doesn’t work when I switched “Autorotate” to NO as following:
RootViewController.mm:(create by cocos2d-x templetes)
-(BOOL) shouldAutorotate {
return NO;
}
Is there anyone know why this function impact CCClippingNode?
If I changed above as “return YES” it can work well, that’s so weird.
I know what’s wrong.
CCLippingNode.cpp:
`bool CCClippingNode::init(CCNode *pStencil)
{
CC_SAFE_RELEASE(m_pStencil);
m_pStencil = pStencil;
CC_SAFE_RETAIN(m_pStencil);
m_fAlphaThreshold = 1;
m_bInverted = false;
// get (only once) the number of bits of the stencil buffer
static bool once = true;
if (once)
{
glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits);
if (g_sStencilBits <= 0)
{
CCLOG("Stencil buffer is not enabled.");
}
once = false;
}
return true;
}`
in ios 5.0
glGetIntegerv(GL_STENCIL_BITS, &g_sStencilBits);
g_sStencilBits is get 0
but if I set it’s value 8,it’s OK,WHY?