[mono-android] Can't detach AndroidGraphicsContext from current thead and attach to another

Andreia Gaita shana at xamarin.com
Mon Feb 27 20:59:08 UTC 2012


Hi,

Sharing contexts is not supported for most android api levels iirc,
you need to check what opengl reports as supported at runtime. The
4.0.5 release should allow you to create multiple contexts and switch
between them to do background loading of textures, though. Note: when
OnLoad is called, the context is already created but it's not current,
so you need to do MakeCurrent there for the main context. Also, the
context is create in CreateFrameBuffer, so if you override this
method, you can set things in the main context and then call base() to
have it created.

andreia

On Mon, Feb 27, 2012 at 8:43 PM, chris at Terrago <cdrake at terragotech.com> wrote:
> I am attempting to separate the OpenTK rendering for my view onto a separate
> thread. After doing some research into this I found that there are two
> methods for this recommended on the OpenTK site
>
> 1. Create a separate graphics context for each thread
> 2. Share a single graphics context between threads by using MakeCurrent to
> detach and attach it
>
> I have tried both methods and continuously get InvalidOperation exceptions
> on EGLMakeCurrent when trying to attach the AndroidGraphicsContext to the
> new thread. It also appears that when I attempt method #2 above and use
> GraphicsContext.MakeCurrent(null) to detach from the current thread the
> IsCurrent property on AndroidGraphicsContext remains true, further on the
> next call to AndroidGameView.MakeCurrent I get an InvalidOperation exception
> since, it appears, the graphics context was never released.
>
> Should it be possible to share AndroidGraphicsContext between threads as you
> can an OpenTK GraphicsContext object? Is this possibly something that is
> getting addressed in the upcoming 4.0.5 release? Or, am I just missing
> something?
>
> Thanks,
> Chris
>
> --
> View this message in context: http://mono-for-android.1047100.n5.nabble.com/Can-t-detach-AndroidGraphicsContext-from-current-thead-and-attach-to-another-tp5520013p5520013.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid


More information about the Monodroid mailing list