GLEventListener: dispose or displayChanged?
Posted by Evan Parker on Jun 29, 2018; 8:43pm
URL: https://forum.jogamp.org/GLEventListener-dispose-or-displayChanged-tp4038981.html
Hi Everyone,
I'm a newbie trying to understand the lifetime of GLContexts in my application.
I've noticed some JavaDocs say GLEventListener has functions { init / reshape / display / *dispose* } while other JavaDocs show { init / reshape / display / *displayChanged* }. It appears that "dispose" changed to "displayChanged" at some point in Jogl's history? (Why?)
The documentation for "dispose" says it's called to notify "the listener to perform the release of all OpenGL resources per GLContext, such as memory buffers and GLSL program". This makes sense to me: I create Vertex Buffer Objects when "init" is called, so I'd destroy them in "dispose".
But on my system, GLEventListener has "displayChanged", and not "dispose".
JavaDocs for "displayChanged" don't mention anything about releasing Vertex Buffer Objects. Am I still supposed to delete in "displayChanged" any Vertex Buffer Objects that I create in "init"? Does a call to "displayChanged" mean the GLContext is being destroyed? (If not, how can I tell if I'm supposed to recreate my Vertex Buffer Objects the next time "init" is called?)
Thank you for any understanding you can offer!
Evan