How can we use same VGPath in multiple threads


I am using OpenVG for Map Rendering. I want to know how can i use the vgPath created in one thread and drawing in another thread. This requirements come because I get the map data in different thread, now if I create the vgPath in that thread, VG_NO_CONTEXT error comes. is it possible to create the vgPath in different thread?
Thanks is advance.


Strange - I thought it should be ok to use them directly… odd.

Anyways, since it’s not, create a shared context with the first thread for the second thread (eglCreateContext(display, config, share_context, attribs) and make it current). This will allow you to share resources (like paths) across threads.

That is, if you are using EGL (if not, there may still be something similar available in whatever you’re using). If you’re not, I don’t really know.

Yes, I am using EGL. Also I already tried this thing but when I create the context using eglCreateContext with shared context is not null then it returns into an error EGL_BAD_CONTEXT.

What might be the issue?

The EGL spec says that EGL_BAD_CONTEXT is returned when the share-context is not a valid context of the same client API as the one you’re creating. My guess is it’s just the driver saying: “I don’t support that”. Theoretically, it should be working just fine.

Check with your driver vendor to see if they are limiting contexts to only per application, or if they have some other mechanisms to get past that.