[FIXED] White screen when leaving fullscreen in Mac OS X

Started by butaca, May 18, 2011, 20:32:38

Previous topic - Next topic

butaca

This is a copy of thread: http://lwjgl.org/forum/index.php/topic,3979.0.html [EDIT: I deleted the original post]
I'm re posting in this section because I haven't received any replays since May 10, 2011.

Sorry in advance if this isn't a bug.

----------------------

Hi guys,

This is my first post. Congratulations to the dev team and the community for all your awesome work.  

I have a strange issue. When leaving fullscreen mode - quitting the app or switching to windowed mode - a white screen appears before the app is destroyed or switched to windowed mode. So far, this is only a glitch. The the real issue is that, sometimes the white screen doesn't disappear. When this happens, the white screen remains on top of everything, even if I quit the app. Despite of this, everything works normally and no errors are reported. In fact I can switch to fullscreen again and the white screen disappear.

Useful data:

* I'm not using threads.
* I'm using the Display.getDesktopDisplayMode() mode for fullscreen. Setting it with Display.setDisplayModeAndFullscreen()
* This happens on my Macmini4,1 (NVIDIA GeForce 320M) running Mac OS X 10.6.7 java version "1.6.0_24" 64-Bit.  It is connected to an external Full HD Monitor (1920x1080) via HDMI.
* Never happend in my Macbook1,1 (Intel GMA 950) running the same OS. java version "1.6.0_24" 32-Bit
* LWJGL version: 2.7.1

Any thoughts on this?

Thanks,
Butaca

butaca

Hi guys,

I have the feeling that this thread is going to be a monologue, but anyway, here I go:

I have some more data:

1) If I enable vsync, the bug doesn't happen.
2) If vsync is disabled and I lower the fps to < 60 with Thread.sleep or doing real work (drawing lots of things), the bug doesn't happen. However If I use Display.sync, the bugs stops at fps < 40.

This is really strange.  ???

I would appreciate your thoughts on this.

Thanks,
Butaca

Matzon


Fool Running

Quote from: butaca on May 18, 2011, 20:32:38
* This happens on my Macmini4,1 (NVIDIA GeForce 320M) running Mac OS X 10.6.7 java version "1.6.0_24" 64-Bit.  It is connected to an external Full HD Monitor (1920x1080) via HDMI.
* Never happend in my Macbook1,1 (Intel GMA 950) running the same OS. java version "1.6.0_24" 32-Bit
Just a shot in the dark to eliminate some variables, but have you tried running it on the Macmini4,1 without using HDMI (i.e. on the built-in screen)?
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

butaca

Hi guys,

Thanks for your time!

The Macmini4,1 is a desktop computer. It hasn't a built-in screen. Unfortunately I don't have another monitor to test.

Other facts (confirmed in the MacBook too):

1) The white screen always appears between the switch. It lasts for some milliseconds.
2) It has always the desktop size.
3) If I put a Thread.sleep() after the switching code (Display.setDisplayModeAndFullscreen or Display.setDisplayMode), the white screen remains on top of everything until the sleep ends when going fullscreen. When going to windowed mode, the white screen appears for some milliseconds. In this case, for the duration of the sleep I get an empty window (like an empty AWT window with the correct size).
4) If I put a Display.update() before the Thread.sleep() sometimes, I get some random stuff instead of the white screen.

Hope it helps.

Thanks,
Butaca

kappa

Do you have a small single class code snippet test case handy that can reproduce the bug? should make it easier to test.

butaca

I tested this snippet in the two computers mentioned. It replicates all that I stated through my posts. Here it goes:

package test;

import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;

public class FullscreenTest {

	private static boolean fullscreen;
	private static DisplayMode windowedMode;

	public static void main(String[] args) throws LWJGLException {

		fullscreen = false;
		windowedMode = new DisplayMode(800, 600);
		Display.setVSyncEnabled(false);
		Display.setDisplayMode(windowedMode);
		Display.create();

		boolean running = true;

		while (running) {

			Display.update();
			Keyboard.poll();
			while (Keyboard.next()) {
				if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState()) {
					running = false;
				}
				if (Keyboard.getEventKey() == Keyboard.KEY_F && Keyboard.getEventKeyState()) {
					toggleFullscreen();
				}
			}

			if (Display.isCloseRequested()) {
				running = false;
			}

			// clear to black (to help us distinguish the white screen)
			GL11.glColor4f(0, 0, 0, 1);
			GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

			try {
				// Give the OS as break and simulate work
				Thread.sleep(20);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		Display.destroy();
	}

	private static void toggleFullscreen() throws LWJGLException {
		fullscreen = !fullscreen;
		if (fullscreen) {
			DisplayMode desktopDisplayMode = org.lwjgl.opengl.Display.getDesktopDisplayMode();
			org.lwjgl.opengl.Display.setDisplayModeAndFullscreen(desktopDisplayMode);
		} else {
			org.lwjgl.opengl.Display.setDisplayMode(windowedMode);
		}

		// this call 'sometimes' puts garbage instead of the infamous white
		// screen
		org.lwjgl.opengl.Display.update();

		try {
			// this lets you see white screen. If you comment this block, the
			// white screen appears only for some milliseconds
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}


Thanks again :),
Butaca

NOTE: the edit was due to a typo... not edited the code... I know, I'm kind of paranoid...

kappa

Ok, i'll see if i can run this on a mac this weekend to see if its reproducible.

butaca

Hi kappa,

It is not urgent to me. Please, take your time. Enjoy your weekend! :)

Just wanted to let you know this issue because it potentially could affect lots of mac users.

Don't hesitate to ping me if you need some feedback or something.

Thanks,
Butaca

kappa

I've tested this and been able to see the brief white screen before the switch from fullscreen to windowed mode, however i've not been able to reproduce the white screen remaining on the desktop.

Anyone else able to reproduce the above issue where the desktop sized white screen doesn't disappear?

kappa