Sharing display lists between GLCanvases

I’m trying to share a display list between two GLCanvases. In the first attempt, I simple created two of them, and on the second one, used the constructor new GLCanvas(caps, null, canvas1.getContext(),null), but that doesn’t seem to work (i.e. the display list doesn’t seem to get shared). I saw a forum message saying for GLJPanels, they need to be made visible first… is that true for a GLCanvas? Also, I’m looking at the TestContextSharing demo, but I don’t understad why the second frame is generated on a seperate thread with a delay… is that for some reason necessary?

Yes, you need to make the second Canvas visible in order to force its context to be created. An alternative is to make a small (e.g. 1x1) GLPbuffer and have your GLCanvases share with that. Note that due to implementation details you will actually need to call display() on the GLPbuffer once before its OpenGL context will actually be created.

The delay in the TestContextSharing demo is simply for illustration purposes.