• Advertisement
Sign in to follow this  

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

This topic is 1371 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 {

public void create () {	
	fullScreen = false;

public void render () {
	Gdx.gl.glClearColor(1, 0, 0, 1);

	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;

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement