Login  Register

Re: moving GLPanel from one to other AWT container

Posted by Ondrej on Mar 26, 2011; 7:49pm
URL: https://forum.jogamp.org/moving-GLPanel-from-one-to-other-AWT-container-tp2722179p2736502.html

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?

OpenGL documentation (http://www.opengl.org/resources/faq/technical/texture.htm) says:
If you're using multiple rendering contexts and need to share texture objects between contexts, you must explicitly enable texture object sharing. This is done with the wglShareLists() function in Microsoft Windows and glXCreateContext() under X Windows.