Cocos2d-x3.0 区域裁切 的具体应用之游戏公告显示(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-10 12:17 点击:次
<0){
clipW=0;
}
if(clipH<0){
clipH=0;
}
}
if(clipW>0&&clipH>0){
//glScissor(clipX ,clipY ,clipW, clipH);
Director::getInstance()->getOpenGLView()->setScissorInPoints(clipX ,clipY ,clipW, clipH);//设定裁切区域大小
mClip=Rect(clipX,clipY,clipW,clipH);
}
mClipCounter++;
}
}
void HelloWorld::afterDraw(Renderer *renderer, const kmMat4& parentTransform, bool transformUpdated){
_afterDrawCommand.init(_globalZOrder);
_afterDrawCommand.func = CC_CALLBACK_0(HelloWorld::onAfterDraw, this,parentTransform, transformUpdated);
renderer->addCommand(&_afterDrawCommand);
}
void HelloWorld::onAfterDraw(const kmMat4& parentTransform, bool parentTransformUpdated){
int clipW=1024;
int clipH=768/4;
bool needClip=clipW>0&&clipH>0;
if(isNeedClip()&&needClip){
mClipCounter--;
if(mClipCounter<=0){
glDisable(GL_SCISSOR_TEST);
}else{
mClip=saveOldRect;
//glScissor(mClip.origin.x ,mClip.origin.y ,mClip.size.width, mClip.size.height);
Director::getInstance()->getOpenGLView()->setScissorInPoints(mClip.origin.x ,mClip.origin.y ,mClip.size.width, mClip.size.height);//设定裁剪显示区域
}
}
}
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>