Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:17:21+00:00 2026-06-11T23:17:21+00:00

Today I faced with problem of updating objects in cocos2d-x framework. I try to

  • 0

Today I faced with problem of updating objects in cocos2d-x framework.
I try to download some text in asynchronous thread and then update text in CCTextFieldTTF and after that text field is disappear.

void HelloWorld::callbackFunc(void *Layer, std::vector<promowall::CItem> Items) {
    cocos2d::CCLayer *layer = static_cast<cocos2d::CCLayer *>(Layer);
    cocos2d::CCLabelTTF *label = dynamic_cast<cocos2d::CCLabelTTF *>(layer->getChildByTag(10));
    label->setString("test");    
}

I will be very appreciate if somebody will help me and explain how can I work with openGl and with pthreads.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:17:22+00:00Added an answer on June 11, 2026 at 11:17 pm

    If your callbackFunc is called from this asynchronous thread it may cause race conditions that might cause such a behaviour (cocos caches all the rendered font labels and the CCTextureManager is not thread safe).

    Also (I think you can find the following info in Apple’s OpenGL programming guide) – it is not safe to call all the OpenGL methods from different threads. And if you create this string “test” in a different thread, cocos actually ends up creating a new OpenGL texture (which might be not proper since created in a different thread). I think you can check this theory by creating a different label with the same “test” text somewhere else (on main thread) – if the one created in your code snippet no longer disappears – it means the theory is correct 🙂

    How to fix it?

    I believe you have to create the label (or set text on it) in your main UI thread – for example remember the result of your async callback in a queue and check it periodically in your update method somewhere. And remember about proper locking.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

today I faced with very interesting problem. When I try to rewrite xml file.
Today I faced a strange problem in C#. I have an ASP.NET page where
I faced an interesting problem today. I have 4 strings which I need to
Today I have had a problem with hiding text with text-indent: -9999px rule. I
Today I faced a strange problem. I have an application which is the same
Today I faced the following problem: I registered a new user on my Joobla
Today I faced a problem that there is one memory leak in my iphone
I'm quite new to using NetBeans and today I faced a problem. I have
I have a project that's been using font-face without problem for some time. Today
Today I faced a problem and I'm not able to get weather I understand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.