Re: Where/when is it ok to call setFullscreen()?
Posted by
Marian Schedenig on
Aug 26, 2014; 7:15pm
URL: https://forum.jogamp.org/Where-when-is-it-ok-to-call-setFullscreen-tp4032828p4032941.html
Oh, that explains it then. I guess I wasn't clear enough about calling it from within display() in my original post, sorry.
My (blind) assumption was that since setFullscreen() schedules the actual operation as an EDT runnable, it wouldn't matter where I called it. I guess that also explains why I couldn't reproduce it. The EDT thread switch probably bought me enough time to let it run smoothly when called at the end of display() in my game, or anywhere within display() in my test project (with its much simpler and faster rendering operations).
Based on what I found in the test cases, I changed it to this now:
@Override
public void setFullscreen(final boolean fullscreen)
{
new Thread()
{
@Override
public void run()
{
Thread t = glWindow.setExclusiveContextThread(null);
glWindow.setFullscreen(fullscreen);
if(!fullscreen)
{
center();
}
glWindow.setExclusiveContextThread(t);
}
}.start();
}
Thanks a lot for your help.