Login  Register

Re: NEWT Threading Overview

Posted by Sven Gothel on Dec 05, 2010; 2:12pm
URL: https://forum.jogamp.org/re-NEWT-Threading-Overview-tp1991718p2022385.html

On Tuesday, November 30, 2010 11:08:00 gouessej [via jogamp] wrote:
>
> Hi!
>
> How do you use shared contexts? I have a single GLCanvas that I move from a frame to another one but I lose the textures and the VBO :( When do you create your shared context?

Yes, this is a pity behavior of GLCanvas add/remove code as it is.
remove() really destroys the context, and add() creates it.

But there are good new everybody :)
In the example
  http://jogamp.org/git/?p=jogl.git;a=blob;f=src/junit/com/jogamp/test/junit/jogl/acore/TestSharedContextListAWT.java;h=b44158dce98537b7e12e4a354a702d0082f2b4ef;hb=de2a30104098216963132ed02b3dd66acd799d9e#l65
a shared drawable/context is created upfront holding the shared resources.
Using this approach your expensive GL resources are persistent.

Note: With NewtCanvasAWT the hooked GLWindow (to the AWT Canvas native peer)
is not destroyed at add/remove.

Cheers, Sven