Over at Cocos2d-iPhone an extension was made to allow a single CCSpriteBatchNode render all sprite nodes at once and maintain proper z-ordering. http://www.cocos2d-iphone.org/forum/topic/14747
Attached is the ExtendedSpriteBatchNode that is converted to C++ for Cocos2d-x.
Adding particles has not been converted (yet) and the sorting algorithm has been changed from insertion sort (n^2 worst case) to smooth sort (nlogn worst case).
This class has helped me tremendously with isometric perspectives. Thanks again to the original author!
After those modifications are done the setVertexZ for sprites should work instead of using setZOrder. I usually scale my range values to within 1000, because much higher and stange things start to occur. Also, sprites sometimes have thin alpha “halos” because of the alpha testing.
We’re trying to do the same time, but I’m running into compile errors: it can’t find GL_ALPHA_TEST or glAlphaFunc(). I’m using cocos2d-x. 2.0rc1 on iPhone, so I’m thinking I might have some missing header files?
D
EDIT:
Hmm, ok these things are OpenGL ES1 only, so that seems why I can’t get access to it, does anyone have an example of the replacement code I could use for cocos2d-x 2?
I’m having the same problem. But I noticed in your sample that you setup the shader but don’t run it.
@
setShaderProgram(s_pShader);
@
I tried changing the default shader and setting the alpha value like you did but did not get any farther.
What happens when you set the shader?