Hello,
For my project i integrated a Jogl view inside of Eclipse. In an eclipse view i can not trigger a fullscreen mode thats why i
transfer the GLCanvas to a regular Java frame and then switch to the fullscreen mode. Under certain circumstances the application crashed when
i switched to the fullscreen mode. After an inspecton of the source i found out that the init method is triggered when i switch to the fullscreen mode.
Since i also have an editor where a user can write regular Jogl code and create new objects (e.g. TextRenderer) these new Objects then are on a thread that does not have a current context.
As you can read in the Jogl user guide:
The init() method is called when a new OpenGL context is created for the given GLAutoDrawable. Any display lists or textures used during the application’s normal rendering loop can be safely initialized in init(). It is important to note that because the underlying AWT window may be destroyed and recreated while using the same GLCanvas and GLEventListener, the GLEventListener’s init() method may be called more than once during the lifetime of the application
…
It is strongly recommended that applications always refetch the GL object out of the GLAutoDrawable upon each call to the init(), display() and reshape() methods and pass the GL object down on the stack to any drawing routines, as opposed to storing the GL in a field and referencing it from there. The reason is that multithreading issues inherent to the AWT toolkit make it difficult to reason about which threads certain operations are occurring on, and if the GL object is stored in a field it is unfortunately too easy to accidentally make OpenGL calls from a thread that does not have a current context. This will usually cause the application to crash. For more information please see the section on multithreading
Without fullscreen everything works fine.
My fullscreen method works if objects are recreated in an available setup method (triggered by the init method) which the user can also create in his custom code
to guarantee that the current context is available. But i would like to avoid the recall of the init method when i create the fullscreen frame (for more safety
!).
My question is, how can i realize this.
Any tips and comments are appreciated.