看了CCScrollView的源码发现
重写CCnode 的 beforeDraw()和afterDraw()
CCPoint screenPos = this->convertToWorldSpace(this->getParent()->getPosition());
glEnable(GL_SCISSOR_TEST);
float s = this->getScale();
// CCDirector *director = CCDirector::sharedDirector();
// s *= director->getContentScaleFactor();
CCEGLView::sharedOpenGLView()->setScissorInPoints(screenPos.x*s, screenPos.y*s, m_tViewSize.width*s, m_tViewSize.height*s);
afterDraw() 加入
glDisable(GL_SCISSOR_TEST);
就可以了
留作备忘。