destroying context

hi,
in my app JOGL provides current context through JNI to code written in C++. I need the same context in C++ code after removeNotify method on GLCanvas is called. But removeNotify destroys context. is there any workaround how to JOGL say: don’t destroy context on removeNotify call?

thanks,
Pavel

isn’t possible to extends and overide the method of this class ?

my class extends GLCanvas, but it does not help. super.removeNotify() in my removeNotify() must be called because calling super.super.removeNotify() java does not allow.

Copying context would help, but GLContext method copy() is abstract and I think extending GLContext is not allowed because it is parent for platform depending contexts.

any other idea?

thanks,
Pavel

  • don’t remove the canvas as long as you need a context in your native code
  • execute your native code synchronous from the removeNotify() before calling super.removeNotify()
  • don’t call super.removeNotify() in your removeNotify() implementation
    (if you really need the super.removerNotfy(), you could try to call it after your native code execution via SwingUtilities.invokeLater())