I'm trying to share lists between two contexts on Mac OS but despite my research I couldn't come up with an answer so far. I've found that NSOpenGLContext was able to initialize a context with a shared context but not to set it afterward.

What's the equivalent of wglShareLists on Mac OS?


1 Answer 1


Here is Apple's documentation on the subject.

Essentially, you can either create an NSOpenGLContext (and in doing so, specify the original context you want to share using initWithFormat:shareContext: or use CGGLCreateContext's share parameter. I don't believe it is possible to share resources after initialization.

This will allow you to create a second context that shares all resources with the first context (the one you passed to one of the above functions). You have to make sure both contexts utilize the same GL profile.

There isn't a way to construct an NSOpenGLView (which you are probably using) with a shared context. Instead you'll probably have to swap the existing context out, or use that context as the main one from which you create the shared context.

  • \$\begingroup\$ I'm only working on the OpenGL layer and I do not use any NSOpenGLView. I really must initiate this share context after creating it since both contexts aren't created by myself. Seems like I'll have no choice but to re-create this texture by myself although it's not very good performance speaking. \$\endgroup\$
    – user14170
    Commented Jun 28, 2013 at 15:28
  • \$\begingroup\$ I looked around, and all Apple's documentation I could find discusses sharing only at initialization time. \$\endgroup\$
    – user1430
    Commented Jun 28, 2013 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .