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

Started by
-1 comments, last by Wibbs 9 years, 10 months ago

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;
}


This topic is closed to new replies.

Advertisement