Login  Register

Re: Wrong size when switching to windowed mode

Posted by gouessej on Nov 10, 2012; 10:38am
URL: https://forum.jogamp.org/Wrong-size-when-switching-to-windowed-mode-tp4026835p4026844.html

Hi

I solved my problem that way:
final GLWindow glWindow=joglNewtWindow.getNewtWindow();
final boolean fullscreenOn=glWindow.isFullscreen();
final int screenWidth=glWindow.getScreen().getWidth();
final int screenHeight=glWindow.getScreen().getHeight();
glWindow.setFullscreen(!fullscreenOn);
glWindow.setUndecorated(!fullscreenOn);
glWindow.setTopLevelSize(screenWidth,screenHeight);
glWindow.setTopLevelPosition(0,0);
glWindow.invoke(false, new GLRunnable() {
                               
        @Override
        public boolean run(GLAutoDrawable glAutoDrawable) {
                glWindow.setTopLevelSize(screenWidth,screenHeight);
                return true;
        }
});

I was right, the switch to windowed mode tries to reset the latest size of the window in this mode which is close to 100 * 100 when you just create a GLWindow that you immediately puts into full screen mode. I assume it is intentional and not a bug. Invoking setTopLevelSize a bit later seems to work.
Julien Gouesse | Personal blog | Website