We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I recently had this discussion on stack overflow http://stackoverflow.com/questions/43829384/opengl-state-reset?noredirect=1#comment74705693_43829384
and a user pointed me out that maybe i am leaving the openGL context in a different state each run, and that maybe i can switch openGL context.
wich made me look into: https://forum.processing.org/two/discussion/2879/processing-2-1-1-how-to-get-the-gl-context
Of course almost anyone seems more in the know about openGL JOGL ecc... than me and im REALLY far from attempting a pull.
i was wondering if it was possible to do something like
"switching context"
frame.addWindowListener( new WindowAdapter() {
@ Override
public void windowClosing(WindowEvent we) {
"clearing or switching context"
System.exit(0);
}
} );
and/or maybe if someone can advise me on renderers used by processing or possible combinations to obtain a clean state.
Beacause using awt in addition to processing seems usefull enough to me and its working 80% of the time. of course 20% random fail makes what im doing trash.
Answers
As a user on stackoverflow already mentioned. Its Most likely that you get a solution, when people can debug some code and contribute I know few things about OpenGL, i have no idea of ATW. I recomend to post a minimal example of ATW&Processing&JOGL you are using. Could look like this: https://www.javatpoint.com/java-awt
Just to clearing the buffer(any content) JOGL could look like this: https://github.com/sgothel/jogl-demos/blob/master/src/demos/es2/RawGL2ES2demo.java#L557
You don't have to you can run 10 fragmentShader and release only 2 of them and use the others by something else.
I not sure what you are meaning with switching content. You have a single application with multiple windows? Basically you write something to a "buffer" and it will be their until you don't release it. So switching content you mean switching buffer, i guess.
Good Luck.
the awt components are like this
public class FormVM extends Panel implements ActionListener,Drawable{
}
in the setup() method they add themselves to the PApplet
a custom component is like this
public class RenderArea extends XYGroup{
}
and it is rendered in the main PApplet draw() loop like this
In the above example RenderArea renders the components within it after translating them with slidebars, it also clips the area so that it can contain an area larger than itself.
This is only an example, but here the push/pop and the clip() functions break up at random at the very beginning of the run, else they dont at all.
the loading is made by detecting all components, instantiating them, and calling their setup method.
There is only one instance of PApplet per jvm, and multiple jvms can run without problems, only i occasionally get draw loop fails on push/pop clip() ecc...
also i saw sometimes a pop failing right after a push, with too many pop exception suggesting that there are interactions with "something" other in graphics, i guess the awt thread but i dont know at all about graphics, i tought this was a rather simple thing to do and just wanted a clean start.
@JDev
personal im out of time. what i can say: If you building jogl (with atw) from source the tests runnig about **1 hour ** various window creations (multiple windows, splitwindows, offscreen etc) tones of examples. hope you will find what you search
https://jogamp.org/jogl/doc/HowToBuild.html
https://github.com/sgothel/jogl/tree/master/src/test/com/jogamp/opengl
try also to post the same thing into the jogl forum, the users their are more experience with atw.
http://forum.jogamp.org/jogl-f782158.html