displaying multiple GLCanvases

While trying to run two GLCanvases in parallel, I seem to be running into a couple of strange problems:

  1. When i add a texture to the second canvas after the canvas has already been initialized, it shows a white square rather than the texture. However, when I then reload the scene from settings (i.e., with the texture assigned during the initialization process), everything looks fine.
  2. Both canvases are playing videos (extracting quicktime into textures). However, whenever one video is playing, the other seems to be barely moving. This time the effect is sort of an opposite of #1: Loading a different video instead of the one loaded in the beginning seems to unstuck the playback and then both videos play fine.

I realize that this might be specific to my code, but i just wanted to make sure there are no obvious JOGL things that might be responsible - since everything works fine when just one GLCanvas is active.

A few more things:

  1. I don’t know in advance how many GLCanvases I’ll need (it’s up to the user to create/destroy internal frames that show the GLCanvas).
  2. I’m not using Animator, since the program is doing plenty of other things apart from this rendering
  3. Running with NVidia GeForce 6600, latest drivers, WinXP. Tried both 1thread false and true.
  4. I don’t need texture sharing. Just have the two (or more) GLCanvases, each playing properly in its own window.

Thanks!
-Jill

There are no known issues in this area. Are you 100% sure you’re using the correct texture ID in your various canvases? Can you boil this down into a concrete test case?

I think this has been partially solved - it had to do, as you said, with texture not being properly initialized for the other GLCanvases. I’m still not very clear how the names of the textures get generated… are these per gl context or global? Should i have those as global somehow, given that i need to give the user an option of switching on the fly an image from one GLCanvas to another?

In any case, another question comes up:
The n created GLCanvases seem, when i move them around, to be in a particular order of overlap.
In and of itself it is not a problem, however, when i want to switch an image (texture) from being displayed in one GLCanvas to being displayed in another, the following happens:

If the GLCanvas that the image is moving FROM is further back than the GLCanvas that the image is moving TO, then everything is fine and the two images show up in the TO GLCanvas properly.
If however, the situation is inverse, depth fighting starts, with flashing and all that.

What should I do to fix this?
Thanks!
-Jill

Texture objects, display lists, vertex and fragment programs, and other OpenGL objects are maintained on a per-context basis. You can share them between contexts by passing another GLDrawable as the “shareWith” parameter to the various GLDrawableFactory methods. Note that sharing is transitive, so if you have GLCanvases A and B sharing textures and display lists, and have new GLCanvas C share with A, it will naturally also share with B.

There is no behind-the-scenes Z ordering of GLCanvases. I suspect all of your problems are coming from using invalid texture IDs. You should install the DebugGL pipeline at the beginning of your GLEventListener.init() method and clear up any exceptions that are thrown. If you’re still having problems after that then try to come up with and post a small test case.