Primitives and sprites Z index in Cocos2D-x 3.0 is not consistent?

前端 未结 2 1099
野性不改
野性不改 2021-01-16 09:03

I have two layers. Each layer has a primitive drawing in it with OpenGL like this:

void Layer1::drawPolygon()
{
    glLineWidth(1);
    DrawPrimitives::setDr         


        
相关标签:
2条回答
  • 2021-01-16 09:43

    I believe there is a bug in cocos2d-x V3 beta 2 that makes primitive drawing always appear below all layers. It is fixed (I understand) in V3.0 RC

    This is incorrect - there is no bug (I was mislead by other posts - my apologies).

    See the post below for a link explaining what needs to happen to get primitives to draw in the 'right' z-order.

    The summary is that all drawing operations are added to a queue in the game loop, then the queue processed - so you need to add your primitive drawing into the queue rather than drawing immediately.

    0 讨论(0)
  • 2021-01-16 09:57

    Due to the new multithreader renderer on cocos2d-x 3.0, drawing with primitives requires a different approach. Take a look at my reply at this thread:

    https://stackoverflow.com/a/22724319/1468700

    0 讨论(0)
提交回复
热议问题