Android really low performance on DrawNode rendering

Android really low performance on DrawNode rendering
0.0 0



I developing cross-platform game using cocos2d-x, few days ago I started porting it from iOS to Android and I saw really strange problem. I using DrawNode class to render some simple objects(like circles), my app gets really laggy on Android phones(I tested app on Huawei P8 Lite and Samsung Galaxy A5-16), on iPhone 6 there is no problem with that. Maybe somebody meet problem like that and know, how to solve it?

Thanks in advance.


Can you show code, please? Are you batching?


Is it a drawing app?


My code of this functionality is really simple, I start from creating DrawNode object, next I draw on it using RenderCircle methods and at the end I push it on the screen by visit method in every frame. I wonder, how can I batch it in some way and create new circles only, when some status in app is changed. I know, that in cocos2dx v3 Sprite Is batched automatically, but I don’t know, how can I achieve that in DrawNode object? And why I don’t have similar problems in old iOS devices?

No, this isn’t a drawing app, this is a typical game.


again, code, code, code. Describing what you are doing and what you actually coded can be to very different things. We can’t help on an assumption.


I describing my code accurately, but if you really want code, I paste it below:

DrawNode *drawNode = DrawNode::create();
for (float i = 0; i < 10; ++i)
	if ((i < (*audioValue)) && (*audioOption))
		texts->RenderCircle(mainRenderer, mainTransform, mainFlags, Color4F::ORANGE, posx + 80.0f + I*30.0f, posy + 35.0f, 10.0f, drawNode);
        texts->RenderCircle(mainRenderer, mainTransform, mainFlags, Color4F::GRAY, posx + 80.0f + i*30.0f, posy + 35.0f, 10.0f, drawNode);
drawNode->visit(mainRenderer, mainTransform, mainFlags);


I recall there being a few GitHub issues about DrawNode performance where one of the engineers wrote some ideas on batching. I will see if I can locate them.

What is texts?


texts->RenderCircle run method from different class:

void RenderCircle(cocos2d::Renderer *renderer, cocos2d::Mat4 transform, uint32_t flags, Color4F color, float posx, float posy, float radius, cocos2d::DrawNode *drawNode)
    drawNode->drawSolidCircle(Vec2(posx, (Director::getInstance()->getVisibleSize()).height - posy), radius, 360, 1000, color);

If you will found sth interesting about batching DrawNode, I really wait for info about it.


I read that one should use as few DrawNode objects as possible. Instead of creating multiple DrawNode objects just use one DrawNode and draw multiple shapes.


About that type of optimization I know and I use it now. When I don’t use it I get really laggy screen on iPhone, now on iOS run really smoothly, but on Android is some problem with it. I noticed, that method drawSolidCircle slow down application at most.


Bump. Any new info about this problem?


I will update GitHub issue and ask out engineering team to take a look at it


Can you give a link to this issue on GitHub?



Thanks, but in this issue I don’t see any new things from more than year. This really breaks efficiency on Android phones.


Please update it!