Login  Register

Re: moving GLPanel from one to other AWT container

Posted by Sven Gothel on Mar 26, 2011; 11:02pm
URL: https://forum.jogamp.org/moving-GLPanel-from-one-to-other-AWT-container-tp2722179p2737290.html

On Saturday, March 26, 2011 20:49:10 Ondrej [via jogamp] wrote:

>
> I guess this piece of code:
>
> @Override
> public void init(GLAutoDrawable drawable) {
>     if(drawable.getContext() != parentCanvas.getContext()) {
>         drawable.setContext(parentCanvas.getContext());
>     }
> }
>
> was nonsense.
>
> I got it work just by passing shared parent context to GLCanvas constructor.
> If such canvas is moved into other AWT container, context instance changes
> but textures created with previous context (before the movement) are still
> usable.
>
> But I still can not use textures created directly in parent context. Any
> idea?
>

http://jogamp.org/git/?p=jogl.git;a=tree;f=src/test/com/jogamp/opengl/test/junit/jogl/acore

2 unit tests for shared context AWT and NEWT

~Sven