It would more than likely be a better way to get the supported resolutions from LWJGL. On some systems, notably linux, invalid refresh rates are reported from AWT and results in the window failing to be created. The resolution given to JME is validated against LWJGL, and if no match is found it will reject it. So if we get the resolutions from the LWJGL, we won’t have any issue.
The code snippets below get the resolutions from each:
LWJGL2
DisplayMode[] modes = Display.getAvailableDisplayModes();
for (int i=0;i<modes.length;i++) {
DisplayMode current = modes[i];
System.out.println(current.getWidth() + "x" + current.getHeight() + "x" +
current.getBitsPerPixel() + " " + current.getFrequency() + "Hz");
}
LWJGL3
PointerBuffer monitors = GLFW.glfwGetMonitors();
for ( int i = 0; i < monitors.limit(); i++ ) {
long monitor = monitors.get(i);
GLFWVidMode.Buffer modes = GLFW.glfwGetVideoModes(monitor);
int modeCount = modes.sizeof();
for ( int j = 0; j < modeCount; j++ ) {
modes.position(j);
int width = modes.width();
int height = modes.height();
int rate = modes.refreshRate();
System.out.println("Resolution: " + width + " x " + height + " @ " + rate);
}
}
The results can be wrapped to provide an API that returns the same result for both versions.
As far as I’m aware, though, these can’t be run until LWJGL is initialized. Is it possible to initialize LWJGL before the AppSettings dialog is displayed and report the LWJGL resolutions?