Log in or register to post comments

OpenGL texture load on separate thread

November 1, 2011 - 3:38pm #1

Hello,
I need to load textures for different animations when QCAR recognizes a marker. I want to load them on a separate thread from the rendering thread so that the camera doesn't appear frozen during this process. Is there a way to accomplish this in android. I was able to do this successfully in ios because I could setup another OpenGL context on another thread that used the same sharegroup, but I'm not sure if there is a similar facility on android.

Re: OpenGL texture load on separate thread

November 14, 2011 - 2:54pm #5

The onPostExecute() method is called in the main thread and there shouldn't be a problem as far as I know with the OpenGL context.

Or do you want to pass the extracted bitmap data of the texture also inside that separate thread?
If so do you really need a to have the OpenGL context for accessing some native texture buffer and copy the bitmap data into it?

Re: OpenGL texture load on separate thread

November 11, 2011 - 8:22am #4

That wouldn't work because you need a shared open gl context on that separate thread. That's the problem I'm having, figuring out how to create a new context and share with the existing one.

Re: OpenGL texture load on separate thread

November 10, 2011 - 11:14pm #3

Try using the AsyncTask class for this.

Load your texture in the onBackground(...) method and pass it to the native components in onPostExecute(...).

Best regards

Re: OpenGL texture load on separate thread

November 1, 2011 - 8:39pm #2

I've never tried this... Perhaps someone in the community has the answer? Otherwise I suggest asking in the Android Developers Google group. In fact, here's a thread that might be relevant:

http://groups.google.com/group/android-platform/browse_thread/thread/a9931ef61a5648c5

- Kim

Log in or register to post comments