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

  • Home
  • SEARCH
  • 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 4013792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:24:57+00:00 2026-05-20T09:24:57+00:00

On iOS I have always assume that it is not possible to do OpenGL

  • 0

On iOS I have always assume that it is not possible to do OpenGL texture creation – glTexImage2D – on a separate thread via an NSOperation subclass. Can someone please confirm/deny.

Since texture creation potentially hang the GUI – bad! – has anyone come up with a workaround that they are happy with?

Thanks,
Doug

  • 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-05-20T09:24:58+00:00Added an answer on May 20, 2026 at 9:24 am

    Yes, take a look at CCTextureCache.m in cocos2d for iPhone.

    cocos2d-iphone / cocos2d / CCTextureCache.m

    NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
    
    // textures will be created on the main OpenGL context
    // it seems that in SDK 2.2.x there can't be 2 threads creating textures at the same time
    // the lock is used for this purpose: issue #472
    [contextLock_ lock];
    if( auxGLcontext == nil ) {
        auxGLcontext = [[EAGLContext alloc]
                               initWithAPI:kEAGLRenderingAPIOpenGLES1
                               sharegroup:[[[[CCDirector sharedDirector] openGLView] context] sharegroup]];
    
        if( ! auxGLcontext )
            CCLOG(@"cocos2d: TextureCache: Could not create EAGL context");
    }
    
    if( [EAGLContext setCurrentContext:auxGLcontext] ) {
    
        // load / create the texture
        CCTexture2D *tex = [self addImage:async.data];
    
        /* This method calls glTexImage2D. */
    
    
        // The callback will be executed on the main thread
        [async.target performSelectorOnMainThread:async.selector withObject:tex waitUntilDone:NO];        
    
        [EAGLContext setCurrentContext:nil];
    } else {
        CCLOG(@"cocos2d: TetureCache: EAGLContext error");
    }
    [contextLock_ unlock];
    
    [autoreleasepool release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm starting to work with OpenGL in iOS. I have always learned to draw
I have an iOS 5 app that uses NSURLConnection to load some XML via
I have an iOS app that uses a number of enums for valid values,
I have an iOS app with a UITableView that has flexible width, which allow
I have a website optimized as a web app with iOS safari, so that
I have a video that I play. To use full screen in iOS 3.2
NOTE: This is for Mac OS X not iOS I have a client app
I have a few questions about screen resolution, that I'm not clear on. These
Have a (rather complex) app that works fine on iOS 4 but fails on
I have some C code in an iOS project that I would like to

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.