Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[libgdx] Black screen when toggling from fullscreen to windowed mode

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 Wibbs   Members   

129
Like
0Likes
Like

Posted 15 June 2014 - 05:59 PM

Hey all,

 

I have just started working with libgdx, and have run into my first problem. I have a simple program that switches a desktop application from windowed mode to fullscreen and back again. If I start the program in windowed mode, it initially displays fine. When I toggle to full screen it is also OK.

 

However, when I toggle back to windowed mode the screen goes completely black. The application remains responsive though, and if I toggle again it will go back to fullscreen and display correctly.

 

I am using 64-bit Windows 7 with the IntelliJ IDEA IDE.

 

Any help with working out why it is doing this would be greatly appreciated.

 

A minimal example that displays the issue is shown below:

 

 

public class MyGdxGame extends ApplicationAdapter {

@Override
public void create () {	
	fullScreen = false;
}

@Override
public void render () {
	Gdx.gl.glClearColor(1, 0, 0, 1);
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

	if (Gdx.input.isKeyPressed(Input.Keys.TAB)) {
		fullScreen = !fullScreen;
		DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
		Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, fullScreen);
	}
}

private boolean fullScreen;
}







Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.