Can texture objects be shared among rendering contexts?

I am developing my first OpenGL app in and for Windows.
I currently only have access to the 1.0 API, but may upgrade my IDE if necessary to gain later functionality.

My app has several separate windows (not just panes or viewports of one window).
Therefore I believe I must use several GL rendering contexts.
However, many of the same textures are used in multiple windows.

Is there a way (using 1.0 API) to share texture objects among OpenGL rendering contexts?


Development environment: Windows 7 Pro SP1, Dell Precision 7510, Embarcadero C++ Builder XE
Display adapter: AMD FirePro W5170M with 2GB GDDR5 dedicated memory
OpenGL:
Vendor: ATI Technologies Inc.
Renderer: AMD FirePro W5170M
Version: 4.5.13411 Compatibility Profile Context FireGL 15.201.2701.0

No, but that’s only because the “1.0 API” doesn’t have texture objects. Texture objects were added to OpenGL in version 1.1. And incidentally, Windows doesn’t support the “1.0 API”; it only supports 1.1 and above.

In any case, you can share sharable objects between contexts in OpenGL. This is best done at context creation time though wglCreateContextAttribARB, but you can do it right after creating a context with wglShareLists. This function is called “share lists”, but it actually shares all sharable objects.

Thank you for the correction regarding Windows supporting OpenGL 1.1.

In any case, you can share sharable objects between contexts in OpenGL. This is best done at context creation time though wglCreateContextAttribARB, but you can do it right after creating a context with wglShareLists. This function is called “share lists”, but it actually shares all sharable objects.

I have tried using wglShareLists (wglCreateContextAttribARB is supported from version 3.0). Unfortunately my texture names are not being found in the secondary rendering contexts.

  • Is it necessary to share lists before loading any textures in the main context? I hope not as my secondary windows can be dynamically created.
  • Are you sure that wglShareLists shared textures in OpenGL 1.1?
  • Once I get it working (optimist :)) does the sharing work both ways? That is, will I be able to create a new texture object in a secondary context and have it available to be used in the main context and any other contexts that share with the main context?

Are you checking that wglShareLists() succeeded? There are several reasons why it can fail.

No. It is necessary to call wglShareLists() before creating any objects on the secondary context.

Yes.

Yes. wglShareLists() causes both contexts to share a single “space” for shareable objects.

I now have wglShareLists working as required.
Thanks for all the replies.