Getting info on invalid display mode

Hi all,
Just wondering, how do you get information regarding not creating a LWJGL window?

Heres our current code:


DisplayMode[] modes = Display.getAvailableDisplayModes();
        //Make sure that we find the mode that uses our current monitor freq.

        for (int i = 0; i < modes.length; i++) {
            if (modes[i].width == width && modes[i].height == height
                    && modes[i].bpp == bpp && modes[i].freq == freq) {

            return modes[i]; }
        }

Thx,
DP

Straight out of Super Elvis Game.init():


            if (!windowed) {
                  try {
                        
                        DisplayMode[] dm = Display.getAvailableDisplayModes(640, 480, -1, -1, -1, -1, 60, 85);
                        Display.setDisplayMode(dm, new String[] {
                              "width="+WIDTH,
                              "height="+HEIGHT,
                              "freq="+((int)FRAMERATE),
                              "bpp="+org.lwjgl.Display.getDepth()
                        });
                  
                  } catch (Exception e) {
                        e.printStackTrace(System.err);
                        windowed = true;
                  }
            }
            
            try {
                  int width, height;
                  if (windowed) {
                        width = java.lang.Math.min(org.lwjgl.Display.getWidth(), WIDTH);
                        height = java.lang.Math.min(org.lwjgl.Display.getHeight(), HEIGHT);
                        Window.create(GAME_TITLE, 0, 0, width, height, 16, 0, 0, 0, 0);
                  } else {
                        width = org.lwjgl.Display.getWidth();
                        height = org.lwjgl.Display.getHeight();
                        try {
                              Window.create(GAME_TITLE, 16, 0, 0, 0, 0);
                        } catch (Exception e) {
                              width = java.lang.Math.min(org.lwjgl.Display.getWidth(), WIDTH);
                              height = java.lang.Math.min(org.lwjgl.Display.getHeight(), HEIGHT);
                              Window.create(GAME_TITLE, 0, 0, width, height, 16, 0, 0, 0, 0);
                        }
                  }
                  NvidiaInitializer.initialize(2048 * 2048, 0);
            } catch (Exception e) {
                  e.printStackTrace();
                  cleanup();
                  Sys.alert(
                        GAME_TITLE,
                        "You need an OpenGL compatible graphics card to run "
                              + GAME_TITLE
                              + ". You may have a suitable graphics card but not have OpenGL drivers. Please contact "
                              + EMAIL_ADDRESS
                              + " for assistance or visit our website if you need help finding OpenGL drivers for your graphics card.");
                  Support.doSupport("opengl");
                  exit();
            }


Cas :slight_smile: