Package org.lwjgl.opengl

Examples of org.lwjgl.opengl.DisplayMode


    }
  }

  private void initialize() {
    try {
      Display.setDisplayMode(new DisplayMode(width, height));
      Display.setTitle("2D Lighting");
      Display.create(new PixelFormat(0, 16, 1));
    } catch (LWJGLException e) {
      e.printStackTrace();
    }
View Full Code Here


      if (fullscreen) {
        DisplayMode[] modes = Display.getAvailableDisplayModes();
        int freq = 0;

        for (int i = 0; i < modes.length; i++) {
          DisplayMode current = modes[i];

          if ((current.getWidth() == width)
              && (current.getHeight() == height)) {
            if ((targetDisplayMode == null)
                || (current.getFrequency() >= freq)) {
              if ((targetDisplayMode == null)
                  || (current.getBitsPerPixel() > targetDisplayMode
                      .getBitsPerPixel())) {
                targetDisplayMode = current;
                freq = targetDisplayMode.getFrequency();
              }
            }

            // if we've found a match for bpp and frequence against
            // the
            // original display mode then it's probably best to go
            // for this one
            // since it's most likely compatible with the monitor
            if ((current.getBitsPerPixel() == originalDisplayMode
                .getBitsPerPixel())
                && (current.getFrequency() == originalDisplayMode
                    .getFrequency())) {
              targetDisplayMode = current;
              break;
            }
          }
        }
      } else {
        targetDisplayMode = new DisplayMode(width, height);
      }

      if (targetDisplayMode == null) {
        throw new SlickException("Failed to find value mode: " + width
            + "x" + height + " fs=" + fullscreen);
View Full Code Here

  /**
   * Sets the display mode for fullscreen mode
   */
  protected boolean setDisplayMode() {
    // get modes
    DisplayMode dm = new DisplayMode(WINDOW_WIDTH, WINDOW_HEIGHT);

    try {
      Display.setDisplayMode(dm);
      return true;
    } catch (Exception e) {
View Full Code Here

  }

  private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    if ( !GLContext.getCapabilities().OpenGL20 )
      throw new RuntimeException("OpenGL 2.0 is required for this demo.");
View Full Code Here

    //check for window key
    if ( Keyboard.isKeyDown(Keyboard.KEY_W) ) {
      try {
        cleanup();

        mode = new DisplayMode(800, 480);
        Display.setDisplayModeAndFullscreen(mode);

        reinit();
      } catch (Exception e) {
        e.printStackTrace();
View Full Code Here

    final int HEIGHT = 480;

    Display.setLocation((Display.getDisplayMode().getWidth() - WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - HEIGHT) / 2);
    try {
      Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
    } catch (PowerManagementEventException e) {
      e.printStackTrace();
    }
    Display.setTitle("Gears");
    Display.create(new PixelFormat());
View Full Code Here

    if( Display.isCreated() ) return;
   
    width =newWidth;
    height = newHeight;
    try {
      Display.setDisplayMode( new DisplayMode( width, height ) );
      Display.create();
    } catch ( LWJGLException ex ) {
      Logger.getLogger( Platform.class.getName() ).log( Level.SEVERE, null, ex );
    }
View Full Code Here

        if (_inited) {
            return;
        }

        // create the Display.
        DisplayMode mode;
        if (_settings.isFullScreen()) {
            mode = getValidDisplayMode(_settings);
            if (null == mode) {
                throw new Ardor3dException("Bad display mode (w/h/bpp/freq): " + _settings.getWidth() + " / "
                        + _settings.getHeight() + " / " + _settings.getColorDepth() + " / " + _settings.getFrequency());
            }
        } else {
            mode = new DisplayMode(_settings.getWidth(), _settings.getHeight());
        }

        final PixelFormat format = new PixelFormat(_settings.getAlphaBits(), _settings.getDepthBits(),
                _settings.getStencilBits()).withSamples(_settings.getSamples()).withStereo(_settings.isStereo());
View Full Code Here

  public BufferedImage getOutsideView() {
      //DisplayMode[] availableDisplayModes = null;
      try {
        //availableDisplayModes = Display.getAvailableDisplayModes();
         
        Display.setDisplayMode(new DisplayMode(800, 600));
     
        //Display.setDisplayMode(availableDisplayModes[0]);
        Display.setTitle("");
      Display.create();
    } catch (LWJGLException e) {
View Full Code Here

  public static void createMainWindow(int _width, int _height) {
    Display.setLocation((Display.getDisplayMode().getWidth() - _width) / 2,
        (Display.getDisplayMode().getHeight() - _height) / 2);
    try {
      Display.setDisplayMode(new DisplayMode(_width, _height));
      Display.setTitle(windowTitle);
      Display.setVSyncEnabled(true); // for VSync (TZ)
      Display.create();
    } catch (LWJGLException e) {
      throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.lwjgl.opengl.DisplayMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.