Very slow Display.getAvailableDisplayModes() at windows?

Started by Schnitter, November 26, 2007, 14:20:15

Previous topic - Next topic

Schnitter

I'm trying to do this:
for(int i = 0; i < Display.getAvailableDisplayModes().length; i++){
			DisplayMode dm = Display.getAvailableDisplayModes()[i];
			dmList.addItem(dm.toString());
			if(pp.width == dm.getWidth() && pp.height == dm.getHeight() && pp.bpp == dm.getBitsPerPixel() && pp.frequency == dm.getFrequency())
				dmList.setSelectedIndex(i);
			waitBar.setValue(i);
		}

I'm creating a little dialog with swing to configure the display-settings in my game. For this, I wrote a "PresentParameters"-class(s.o. already know the name from D3D).
In Linux, it's "normal" fast, I can see the JFrame in a fwe seconds. But in Windows, it's very slow. It need's ~30sek. Because of that, I added a JProgressBar(waitBar).
It's better now, but I'm wondering, why it takes so long just to read out all of the displaymodes.


Hope for an answer ;)


MfG

Matzon

 :o
how many modes do you get ?

this shouldn't take longer than a fraction of a second.

Schnitter

I added a timer to my application to stop, how much seconds it needs.
Output: The initialisation took 36 seconds
(!)
I get 220 DisplayModes.



Edit: Did I write "Initialisation" correctly? I dont' think so :-/
Edit2: Would it be better for you, when I upload the application?

Matzon

sure, but I suspect that its the checking of the display modes validity in the win32 api that is slow, for some non-apparent reason.

Schnitter

So I can't do anyting against it?
I mean, it's no problem, but it's a little bit strange :/



MfG

elias

This thread describes a similar problem:

http://www.javagaming.org/forums/index.php?topic=15579.0

The only suggested fix is updating your drivers (or replacing the graphics card ;))

- elias

Fool Running

A suggestion:
Don't call Display.getAvailableDisplayModes() more then once. You call it 2 times each time through the loop.
Do something like DisplayMode[] modes = Display.getAvailableDisplayModes() and just use that array.
That should help a lot with the speed.

Hope that helps ;D

EDIT: I still have LWJGL v1.1, but it looks like the windows implementation re-gets the display mode list each time Display.getAvailableDisplayModes() is called, so you should notice a significant improvement in speed doing it that way. ;)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Schnitter

Hey, it works!
"The initialisation took 0 seconds"
:D

Thank you, I never thought that way :/