Administrator
|
Hi
I use the following code: glWindow.setFullscreen(false); glWindow.setUndecorated(false); glWindow.setTopLevelSize(screenWidth,screenHeight); glWindow.setTopLevelPosition(0,0); Sometimes, the window size is 100 * 100 even though I call setTopLevelSize(1024, 780). Is it the right way of switching to windowed mode?
Julien Gouesse | Personal blog | Website
|
Administrator
|
When I run my game, I see the window with a small size (100 * 100) during a fraction of second and then it goes fullscreen. The very first time I try to switch back to windowed mode, it sometimes goes back to this size instead of the passed size.
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by gouessej
On 11/08/2012 11:43 PM, gouessej [via jogamp] wrote:
> Hi > > I use the following code: > glWindow.setFullscreen(false); If every thing else was default and window size as desired before switch to FS via "glWindow.setFullscreen(true)", then: > glWindow.setUndecorated(false); - is redundant > glWindow.setTopLevelSize(screenWidth,screenHeight); - that would be like fullscreen as a window > glWindow.setTopLevelPosition(0,0); - if you desire .. > > Sometimes, the window size is 100 * 100 even though I call > setTopLevelSize(1024, 780). Is it the right way of switching to windowed mode? I don't know what your goal is (size, props, ..) hence .. dunno. Pls send little unit test case (copied from one of our ScreenMode tests maybe. ~Sven signature.asc (907 bytes) Download Attachment |
Administrator
|
This post was updated on .
It's for my game. Some people prefer playing in windowed mode. I want the window to be always maximized but I think that if you create a window that you use immediately in full screen mode, it just uses a default value when switching to windowed mode.
Edit.: Does NEWT try to set a size when exiting full screen mode?
Julien Gouesse | Personal blog | Website
|
Administrator
|
In reply to this post by Sven Gothel
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
|
Administrator
|
On 11/10/2012 11:38 AM, gouessej [via jogamp] wrote:
> 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. after leaving fullscreen mode and reset back to default size which is actually 128 x 128. How about setting the default size before setVisible(true) ? It won't affect your desired fullscreen mode, but define the size when you leave fullscreen. If that doesn't work, it's a bug and we should copy one of the ScreenMode unit tests for this purpose. The latter already test combination of this - maybe not your case exactly. ~Sven signature.asc (907 bytes) Download Attachment |
Administrator
|
This post was updated on .
It's an excellent idea, I'm going to give it a try.
Edit.: It is really better now.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |