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 1010221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:02:55+00:00 2026-05-16T09:02:55+00:00

I need to load textures in background thread in OpenGL ES. But glGenTextures always

  • 0

I need to load textures in background thread in OpenGL ES. But glGenTextures always returns zero when called in background thread.

-(void) someMethodInMainThread {
   [self performSelectorInBackground:@selector(load) withObject:nil];
}

-(void) load {
   GLuint textureID = 0;
   glGenTextures(1, &textureID);        
}

textureID is zero.
If i change code to [self performSelector:@selector(tmp) withObject:nil]; it will work correct and return 1.
How should i load textures in background thread?

  • 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-16T09:02:56+00:00Added an answer on May 16, 2026 at 9:02 am

    This is a common error, each OpenGL context can be active (current) in one thread only, so when you create a new thread, it doesn’t have any OpenGL context, and all GL calls fail.

    Solution: Create another OpenGL context, make it current in your background thread. To load textures, you also want to share OpenGL names (texture ids, etc) with the main context.

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

Sidebar

Related Questions

I need to load a custom function from an extern file but without causing
I need to load PNGs and JPGs to textures. I also need to save
i need converted maya to js for simple model with textures work fine but
I'm using QImage to load images which then used as textures in OpenGL. The
I need load external resources from another server like css, template, data... but I
I need to load a Model in a component to save the Data of
I need to Load RVM into a shell session as a function , so
I need to load data into my treestore. My ajax request give me XML
I need to load a lot of data fetched from a mysql db in
I need to load an image from a web in a simple Java stand

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.