GLEventListener.dispose() called by GLJPanel at resize?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GLEventListener.dispose() called by GLJPanel at resize?

Martin
Hi,

My GLEventListener.dispose() method makes some cleanup assuming dispose() is called only when someone close the windows.

Unless I am wrong, it seems that in JOGL2 this method is called when a GLJPanel is resized. Thus the listener continue to live, but all its content get cleared.

What is the reason for calling dispose() without really destroying the listener?

Regards,

Martin
Reply | Threaded
Open this post in threaded view
|

Re: GLEventListener.dispose() called by GLJPanel at resize?

Sven Gothel
Administrator
On 05/23/2012 11:04 AM, Martin [via jogamp] wrote:

> Hi,
>
> My GLEventListener.dispose() method makes some cleanup assuming dispose() is
> called only when someone close the windows.
>
> Unless I am wrong, it seems that in JOGL2 this method is called when a
> GLJPanel is resized. Thus the listener continue to live, but all its content
> get cleared.
>
> What is the reason for calling dispose() without really destroying the listener?
>
b/c GLJPanel may use an FBO, which must be recreated to fit the new size.

If you like to use GLJPanel and keep the GL data, you can use an initial
[offscreen] shared GLContext. However, then you need to figure out when to
release resources of that root GLContext.

~Sven

> Regards,
>
> Martin
Reply | Threaded
Open this post in threaded view
|

Re: GLEventListener.dispose() called by GLJPanel at resize?

Martin
Thanks for clarifying!