Error While displaying long text in cocos2dx

Error While displaying long text in cocos2dx
0.0 0


I have an cocos project in cocos2dx 3.13.1. I have used .plist file to fetch texts for my application. Previously there was only about 80 lines of texts (each line having around 24-25 characters), now according to clients requirement, text will be about 200-250 lines of text. When I increased texts to more than 113 lines of text, only background image will displayed (text not displayed) for any iOS Devices and sony Xperia z1, and the text is displayed in sony Xperia Z5 and samsung galaxy s7 edge. All the texts are displayed properly While logging text in console in Xcode. Following is the error I have found in console.

Please check the following code segment

CCLOG(“Ending Text Log : %s”, text.c_str() );
CCLOG(“Ending Text Log : %s”, text.c_str() );
_labelEnding->setDimensions(_labelEnding->getContentSize().width, _labelEnding->getContentSize().height);
TargetedAction::create(_menuSkip,FadeTo::create(1,255)), //SKIP
DelayTime::create(1), //3 seconds WAIT
FadeTo::create(3,255), //Brighten
DelayTime::create(4), // WAIT 3 seconds
FadeTo::create(1,0), //BG 表示


In above code, all the texts are logged properly in console, but the text are not displayed in iphone5, iphone 6 and iphone 6s+ and sony xperia z1 and displayed in smsung galaxy s7 edge and xperia z5.

When i replaced fourth line of the above code by below code
_labelEnding->setDimensions(_labelEnding->getContentSize().width, 4000);
Texts are displayed in all the devices, but only displayed to 113 lines of text in every devices and the the error i have mentioned in above (glError) are also not displayed in console.

*Note: I have used data type string for storing data in .plist file.
is there any solution ot my issue.


You’re likely just running up against OpenGL limits of how many vertices (and other properties) can be submitted within a single draw call.

I’d recommend splitting apart your labels to hold 50 lines of text, for example, and then position one after the other. I’d also recommend looking into ListView as a potential way to do this more easily since it will do some of the auto-layout/positioning you’ll want.

My assumption based on your description is that this is a credits scroll or similar, and if not then maybe you can describe what the output rendered would look like in words or with a screenshot or example image.


Thankyou @stevetranby. I will try the solution you have suggested and will let you know if it is solved.


Hello @stevetranby
Last day i have tried the solution you have suggested. All the texts are displayed, but next text is displayed once the previous text is completely completed. Texts are not displayed serially on screen. I think we need to run second task (action) 1-2 second before completing first task (action). Is it possible?


You can do whatever you want with the labels. Run multiple actions, run a sequence, use schedule update to manage your own time-based changes. If you have a very specific description of your end result maybe I or someone else can help. Otherwise, it is possible to run action, multiple actions, stop an action, etc.

If you’re scrolling, you could even split the text into single lines, depending on whether you need to have auto-wrapping or not. If you’re cross-fading labels, just either calculate out all your timings and have the next label run fadeIn action at the time T when the current label will run FadeOut. Or whatever you want.