开发者

Keeping a CCLayer on top when using CCGrid3D

开发者 https://www.devze.com 2023-02-14 17:04 出处:网络
I\'ve been playing around with Cocos2d for a couple of days and got a little bit confused regarding depths (z and vertexz props).

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);

}
0

精彩评论

暂无评论...
验证码 换一张
取 消