I've been playing around with Cocos2d for a couple of days and got a little bit confused regarding depths (z and vertexz props).
My test app is using CCActionPageTurn3D to create a page-flip action on a CCLayer and everything works fine. But when I try to keep a couple of GUI buttons (A CCLayer with a CCMenu in it) on top of everything they end up behind the CCLayer where the action is performed. It doesn't matter that z-value i set the GUI to, bu开发者_运维知识库t if I sets its vertexZ to a higher value it stays on top (but gets scaled which I don't want it too). Does anyone have a solution to this?
Solved it myself by overriding the visit method in my GUI class using glDepthFunc:
-(void) visit {
glDepthFunc(GL_ALWAYS);
[super visit];
glDepthFunc(GL_LEQUAL);
}
精彩评论