Sharing resources between GLAutoDrawables

I have an application that opens multiple GLJPanes and GLCanvases. They all draw the same data set, but from slightly different camera views and window aspects. I’m trying to determine if for every pbuffer, texture and shader I delcare, I need to create a unique copy for each GLAutoDrawable, or if they can somehow share these. Sometimes multiple components seem to share a single resource and call it by the same name, but this behaviour is intermitant. To guarantee each component has it’s appearance state correct, I seem to need to create new instance of textures et. al. for each resource.

Are there any other ways to do this?

I think we discussed this offline but what you need to do is share textures and display lists between your GLAutoDrawables by creating the first one and passing the result of getContext() as the “shareWith” parameter to the rest of them. There is a caveat with GLJPanels where their GLContext is (currently) initially null until the first render. This can be worked around by creating a small (1x1) GLPbuffer and using its context as the “shareWith” parameter. This should work on almost all cards; note that you will need to call display() on your GLPbuffer once to get its context to be created. At that point all of your GLAutoDrawables will share “server-side” OpenGL objects and any shader, etc. you create in any one’s context will be usable by all of them.