LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: dayrinni on June 28, 2012, 01:25:41

Title: Display.getAvailableDisplayModes Performance Question
Post by: dayrinni on June 28, 2012, 01:25:41
Hello,

I am working on a game that is using Slick, TWL and LWJGL.

I am writing an options window so the player can decide what resolution they want. So I have a loop that goes through Display.getAvailableDisplayMode to compile all of the modes.



The call to Display.getAvailableDisplayMode takes around 2 seconds to complete. I have been told that this is way too long and I should post here :)

I don't have very interesting code to show besides:


System.out.println("Getting display modes....");
long start = System.nanoTime();
DisplayMode[] displayModes = Display.getAvailableDisplayModes();
long end = System.nanoTime();
System.out.println("FINISHED! Getting display modes....");
System.out.println("getAvailableDisplayModes Time: " + ((end-start)/(1000*1000)) + " ms");


I am using the 2.3.8 LWJGL binaries on a Windows 7 64 bit machine, with the following specs:
2 Monitors (Samsung 3D LEDs that can run at 120hz so the number of supported versions are probably more than the average monitor)
Core i7-950 3.06 GHz
Radeon HD 6950 2GB
6 GB of RAM
I have the 12.1 catalyst drivers from this Jan (Tried to update but for some reason the drivers are not installing correctly and I will have to check AMD's support page).

Thanks for any help you can provide...
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: mattdesl on June 28, 2012, 04:17:18
To LWJGL guys: Is getting the display mode really necessary? Or will LWJGL pick the best display modes for you? Is the "setDisplayMode" method still relevant to today's LWJGL API, or is it outdated?

http://www.lwjgl.org/wiki/index.php?title=LWJGL_Basics_5_(Fullscreen)
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: ra4king on June 28, 2012, 04:38:46
If you want to use the native resolution and refresh rate, don't set a DisplayMode when going full screen.
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: princec on June 28, 2012, 07:34:21
These days I'm using the native desktop settings and not changing modes; in some more advanced games like FPS stuff you'd conceivably want to allow the user to change to lower resolutions for performance reasons.

Cas :)
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: Fool Running on June 28, 2012, 12:33:04
Quote from: dayrinni on June 28, 2012, 01:25:41
The call to Display.getAvailableDisplayMode takes around 2 seconds to complete. I have been told that this is way too long and I should post here :)
...
2 Monitors (Samsung 3D LEDs that can run at 120hz so the number of supported versions are probably more than the average monitor)
How many display modes are you getting?
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: dayrinni on June 28, 2012, 14:33:30
Quote from: Fool Running on June 28, 2012, 12:33:04
Quote from: dayrinni on June 28, 2012, 01:25:41
The call to Display.getAvailableDisplayMode takes around 2 seconds to complete. I have been told that this is way too long and I should post here :)
...
2 Monitors (Samsung 3D LEDs that can run at 120hz so the number of supported versions are probably more than the average monitor)
How many display modes are you getting?

I am getting 122 from the call. I can support a bunch of 100 hz and 120 hz, then the usual 60 hzs.
Title: Re: Display.getAvailableDisplayModes Performance Question
Post by: dayrinni on June 28, 2012, 14:35:51
Quote from: ra4king on June 28, 2012, 04:38:46
If you want to use the native resolution and refresh rate, don't set a DisplayMode when going full screen.

This is good to now. I'll have to see how Slick gets this done so I can exploit it. I was wondering how to do this. Thanks :)