Shared background GL context on iOS problems

Hi,

did anyone manage to create secondary / shared GL context on iOS? My code works fine on Windows but just creating second context on iOS causes many runtime erros.

No one is uploading textures in background thread on iOS?

If you are using SDL’s rendering, then you can’t do this. You can load
image files in a background thread, but you need to create texture in
the same thread that created the OpenGL context.

If you only use SDL to handle events, then you can create two opengl
contexts and use one to create textures in background while you display
using another.On 9/20/2013 2:43 PM, slimshader wrote:

No one is uploading textures in background thread on iOS?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
Game Designer/CEO
http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming

Maybe I didn’t explain clear: I do have second (shared) GL context that is suppose to be current in background thread. I use this second context to upload textures in the background. Problems is, it does not work on iOS giving crashes. On Windows it works OK but it seems iOS implementation of contexts is buggy. Btw: creating a context makes is current which is not a good design imo. Those actions should be separated so it should be possible to create 2nd context in main thread and then pass it to secondary thread which makes it current.

Pallav Nawani wrote:> If you are using SDL’s rendering, then you can’t do this. You can load

image files in a background thread, but you need to create texture in
the same thread that created the OpenGL context.

If you only use SDL to handle events, then you can create two opengl
contexts and use one to create textures in background while you display
using another.

On 9/20/2013 2:43 PM, slimshader wrote:

No one is uploading textures in background thread on iOS?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
Game Designer/CEO
http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I haven’t tried it in iOS either (I am using SDL_Render)
However, I did implement background loading under Windows using Direct
3D renderer (where you can create textures on separate threads). Later I
had to implement loading in the main thread. It wasn’t a big performace
hit.On 9/22/2013 10:11 PM, slimshader wrote:

Maybe I didn’t explain clear: I do have second (shared) GL context
that is suppose to be current in background thread. I use this second
context to upload textures in the background. Problems is, it does not
work on iOS giving crashes. On Windows it works OK but it seems iOS
implementation of contexts is buggy. Btw: creating a context makes is
current which is not a good design imo. Those actions should be
separated so it should be possible to create 2nd context in main
thread and then pass it to secondary thread which makes it current.

Pallav Nawani wrote:
If you are using SDL’s rendering, then you can’t do this. You can load
image files in a background thread, but you need to create texture in
the same thread that created the OpenGL context.

If you only use SDL to handle events, then you can create two opengl
contexts and use one to create textures in background while you display
using another.

On 9/20/2013 2:43 PM, slimshader wrote:

Quote:
No one is uploading textures in background thread on iOS?


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
Game Designer/CEO
http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming


SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
Game Designer/CEO
http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming

I want to do this too.
I want to do all loadings in the background while main thread is display a nice animated loading icon.
Is this possible or not?
I’m need this in iOS and Android.

Limanima wrote:

I want to do this too.
I want to do all loadings in the background while main thread is display a nice animated loading icon.
Is this possible or not?
I’m need this in iOS and Android.

I’m not sure why I can’t edit my own posts, so I’ll correct my writing here:

I want to do this too.
I want to do all loadings in the background while the main thread displays a nice animated loading icon.
Is this possible or not?
I need this on iOS and Android.

I think it’s better now… :smiley:

You can load in background. However, you can do these in the main thread.
Every frame: Load a resource, update percentage completion, draw loading
bar. iPhone4 and lower have a single core processor anyway, so it won’t
matter on those platforms. iPhone5 has a faster processor, so it won’t
matter so much either.On Sat, Oct 12, 2013 at 2:38 AM, Limanima <jorge.raposo.lima at gmail.com>wrote:

**

Limanima wrote:

I want to do this too.
I want to do all loadings in the background while main thread is display a
nice animated loading icon.
Is this possible or not?
I’m need this in iOS and Android.

I’m not sure why I can’t edit my own posts, so I’ll correct my writing
here:

I want to do this too.
I want to do all loadings in the background while the main thread displays
a nice animated loading icon.

Is this possible or not?
I need this on iOS and Android.

I think it’s better now… [image: Very Happy]


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

Regarding post editing: If you’re reading this on the forum, it’s
actually that you’re posting to the SDL development mailing list.
Once you send a message, you can’t edit it in people’s email inboxes,
so no editing. :slight_smile:

JosephOn Fri, Oct 11, 2013 at 09:08:38PM +0000, Limanima wrote:

I’m not sure why I can’t edit my own posts, so I’ll correct my writing here:
[?]