Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.lwjgl.opengl
Class Display

    java.lang.Object
      org.lwjgl.opengl.Display

    public final class Display

extends java.lang.Object

Method Summary
`static void` | `create()` Create the OpenGL context.
`static void` | `create(PixelFormat pixel_format)` Create the OpenGL context with the given minimum parameters.
`static void` | `create(PixelFormat pixel_format, Drawable shared_drawable)` Create the OpenGL context with the given minimum parameters.
`static void` | `destroy()` Destroy the Display.
`static java.lang.String` | `getAdapter()` Get the driver adapter string.
`static DisplayMode[]` | `getAvailableDisplayModes()` Returns the entire list of possible fullscreen display modes as an array, in no particular order.
`static DisplayMode` | `getDisplayMode()` Return the current display mode, as set by setDisplayMode().
`static Drawable` | `getDrawable()` Fetch the Drawable from the Display.
`static java.lang.String` | `getTitle()`
`static java.lang.String` | `getVersion()` Get the driver version.
`static boolean` | `isActive()`
`static boolean` | `isCloseRequested()`
`static boolean` | `isCreated()`
`static boolean` | `isDirty()` Determine if the window's contents have been damaged by external events.
`static boolean` | `isFullscreen()`
`static boolean` | `isVisible()`
`static void` | `makeCurrent()` Make the Display the current rendering context for GL calls.
`static void` | `processMessages()` Process operating system events.
`static void` | `releaseContext()` Release the Display context.
`static void` | `setDisplayConfiguration(float gamma, float brightness, float contrast)` Set the display configuration to the specified gamma, brightness and contrast.
`static void` | `setDisplayMode(DisplayMode mode)` Set the current display mode.
`static void` | `setFullscreen(boolean fullscreen)` Set the fullscreen mode of the context.
`static int` | `setIcon(java.nio.ByteBuffer[] icons)` Sets one or more icons for the Display.
`static void` | `setLocation(int new_x, int new_y)` Set the window's location.
`static void` | `setSwapInterval(int value)` Set the buffer swap interval.
`static void` | `setTitle(java.lang.String newTitle)` Set the title of the window.
`static void` | `setVSyncEnabled(boolean sync)` Enable or disable vertical monitor synchronization.
`static void` | `swapBuffers()` Swap the display buffers.
`static void` | `sync(int fps)` Best sync method that works reliably.
`static void` | `sync2(int fps)` Alternative sync method which works better on triple-buffered GL displays.
`static void` | `sync3(int fps)` Synchronize the display to a capped frame rate.
`static void` | `update()` Update the window.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getDrawable

    public static Drawable getDrawable()

  Fetch the Drawable from the Display.

  Returns:
    the Drawable corresponding to the Display context

### getAvailableDisplayModes

    public static DisplayMode[] getAvailableDisplayModes()
                                                  throws LWJGLException

  Returns the entire list of possible fullscreen display modes as an array, in no particular order. Although best attempts to filter out invalid modes are done, any given mode is not guaranteed to be available nor is it guaranteed to be within the current monitor specs (this is especially a problem with the frequency parameter). Furthermore, it is not guaranteed that create() will detect an illegal display mode. The only certain way to check is to call create() and make sure it works. Only non-palette-indexed modes are returned (ie. bpp will be 16, 24, or 32). Only DisplayModes from this call can be used when the Display is in fullscreen mode.

  Returns:
    an array of all display modes the system reckons it can handle.
  Throws:
    `LWJGLException`

### getDisplayMode

    public static DisplayMode getDisplayMode()

  Return the current display mode, as set by setDisplayMode().

  Returns:
    The current display mode

### setDisplayMode

    public static void setDisplayMode(DisplayMode mode)
                               throws LWJGLException

  Set the current display mode. If no OpenGL context has been created, the given mode will apply to the context when create() is called, and no immediate mode switching will happen. If there is a context already, it will be resized according to the given mode. If the context is also a fullscreen context, the mode will also be switched immediately. The native cursor position is also reset.

  Parameters:
    `mode` - The new display mode to set
  Throws:
    `LWJGLException` - if the display mode could not be set

### setDisplayConfiguration

    public static void setDisplayConfiguration(float gamma,
                                               float brightness,
                                               float contrast)
                                        throws LWJGLException

  Set the display configuration to the specified gamma, brightness and contrast. The configuration changes will be reset when destroy() is called.

  Parameters:
    `gamma` - The gamma value
    `brightness` - The brightness value between -1.0 and 1.0, inclusive
    `contrast` - The contrast, larger than 0.0.
  Throws:
    `LWJGLException`

### sync3

    public static void sync3(int fps)

  Synchronize the display to a capped frame rate. Note that we are being "smart" about the desired results in our implementation; we automatically subtract 1 from the desired framerate to prevent just missing the frame time if vsync is set.

  Parameters:
    `fps` - The desired frame rate, in frames per second

### sync2

    public static void sync2(int fps)

  Alternative sync method which works better on triple-buffered GL displays.

  Parameters:
    `fps` - The desired frame rate, in frames per second

### sync

    public static void sync(int fps)

  Best sync method that works reliably.

  Parameters:
    `fps` - The desired frame rate, in frames per second

### getTitle

    public static java.lang.String getTitle()

  Returns:
    the title of the window

### setFullscreen

    public static void setFullscreen(boolean fullscreen)
                              throws LWJGLException

  Set the fullscreen mode of the context. If no context has been created through create(), the mode will apply when create() is called. If fullscreen is true, the context will become a fullscreen context and the display mode is switched to the mode given by getDisplayMode(). If fullscreen is false, the context will become a windowed context with the dimensions given in the mode returned by getDisplayMode(). The native cursor position is also reset.

  Parameters:
    `fullscreen` - Specify the fullscreen mode of the context.
  Throws:
    `LWJGLException` - If fullscreen is true, and the current DisplayMode instance is not from getAvailableDisplayModes() or if the mode switch fails.

### isFullscreen

    public static boolean isFullscreen()

  Returns:
    whether the Display is in fullscreen mode

### setTitle

    public static void setTitle(java.lang.String newTitle)

  Set the title of the window. This may be ignored by the underlying OS.

  Parameters:
    `newTitle` - The new window title

### isCloseRequested

    public static boolean isCloseRequested()

  Returns:
    true if the user or operating system has asked the window to close

### isVisible

    public static boolean isVisible()

  Returns:
    true if the window is visible, false if not

### isActive

    public static boolean isActive()

  Returns:
    true if window is active, that is, the foreground display of the operating system.

### isDirty

    public static boolean isDirty()

  Determine if the window's contents have been damaged by external events. If you are writing a straightforward game rendering loop and simply paint every frame regardless, you can ignore this flag altogether. If you are trying to be kind to other processes you can check this flag and only redraw when it returns true. The flag is cleared when update() or isDirty() is called.

  Returns:
    true if the window has been damaged by external changes and needs to repaint itself

### processMessages

    public static void processMessages()

  Process operating system events. Call this to update the Display's state and make sure the input devices receive events. This method is called from update(), and should normally not be called by the application.

### swapBuffers

    public static void swapBuffers()
                            throws LWJGLException

  Swap the display buffers. This method is called from update(), and should normally not be called by the application.

  Throws:
    `OpenGLException` - if an OpenGL error has occured since the last call to GL11.glGetError()
    `LWJGLException`

### update

    public static void update()

  Update the window. This calls processMessages(), and if the window is visible clears the dirty flag and calls swapBuffers() and finally polls the input devices.

  Throws:
    `OpenGLException` - if an OpenGL error has occured since the last call to GL11.glGetError()

### releaseContext

    public static void releaseContext()
                               throws LWJGLException

  Release the Display context.

  Throws:
    `LWJGLException` - If the context could not be released

### makeCurrent

    public static void makeCurrent()
                            throws LWJGLException

  Make the Display the current rendering context for GL calls.

  Throws:
    `LWJGLException` - If the context could not be made current

### create

    public static void create()
                       throws LWJGLException

  Create the OpenGL context. If isFullscreen() is true or if windowed context are not supported on the platform, the display mode will be switched to the mode returned by getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be created with the given parameters, a LWJGLException will be thrown.

  The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.

  Throws:
    `LWJGLException`

### create

    public static void create(PixelFormat pixel_format)
                       throws LWJGLException

  Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed context are not supported on the platform, the display mode will be switched to the mode returned by getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be created with the given parameters, a LWJGLException will be thrown.

  The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.

  Parameters:
    `pixel_format` - Describes the minimum specifications the context must fulfill.
  Throws:
    `LWJGLException`

### create

    public static void create(PixelFormat pixel_format,
                              Drawable shared_drawable)
                       throws LWJGLException

  Create the OpenGL context with the given minimum parameters. If isFullscreen() is true or if windowed context are not supported on the platform, the display mode will be switched to the mode returned by getDisplayMode(), and a fullscreen context will be created. If isFullscreen() is false, a windowed context will be created with the dimensions given in the mode returned by getDisplayMode(). If a context can't be created with the given parameters, a LWJGLException will be thrown.

  The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.

  Parameters:
    `pixel_format` - Describes the minimum specifications the context must fulfill.
    `shared_drawable` - The Drawable to share context with or null.
  Throws:
    `LWJGLException`

### destroy

    public static void destroy()

  Destroy the Display. After this call, there will be no current GL rendering context, regardless of whether the Display was the current rendering context.

### isCreated

    public static boolean isCreated()

  Returns:
    true if the window's native peer has been created

### setSwapInterval

    public static void setSwapInterval(int value)

  Set the buffer swap interval. This call is a best-attempt at changing the monitor swap interval, which is the minimum periodicity of color buffer swaps, measured in video frame periods, and is not guaranteed to be successful. A video frame period is the time required to display a full frame of video data.

  Parameters:
    `sync` - true to synchronize; false to ignore synchronization

### setVSyncEnabled

    public static void setVSyncEnabled(boolean sync)

  Enable or disable vertical monitor synchronization. This call is a best-attempt at changing the vertical refresh synchronization of the monitor, and is not guaranteed to be successful.

  Parameters:
    `sync` - true to synchronize; false to ignore synchronization

### setLocation

    public static void setLocation(int new_x,
                                   int new_y)

  Set the window's location. This is a no-op on fullscreen windows. The window is clamped to remain entirely on the screen. If you attempt to position the window such that it would extend off the screen, the window is simply placed as close to the edge as possible.
  noteIf no location has been specified (or x == y == -1) the window will be centered

  Parameters:
    `x` - The new window location on the x axis
    `y` - The new window location on the y axis

### getAdapter

    public static java.lang.String getAdapter()

  Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2", "Radeon9700". If the adapter cannot be determined, this function returns null.

  Returns:
    a String

### getVersion

    public static java.lang.String getVersion()

  Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined, this function returns null.

  Returns:
    a String

### setIcon

    public static int setIcon(java.nio.ByteBuffer[] icons)

  Sets one or more icons for the Display.
  - On Windows you should supply at least one 16x16 icon and one 32x32.
  - Linux (and similar platforms) expect one 32x32 icon.
  - Mac OS X should be supplied one 128x128 icon
  The implementation will use the supplied ByteBuffers with image data in RGBA and perform any conversions nescesarry for the specific platform.

  NOTE: The display will make a deep copy of the supplied byte buffer array, for the purpose of recreating the icons when you go back and forth fullscreen mode. You therefore only need to set the icon once per instance.

  Parameters:
    `icons` - Array of icons in RGBA mode. Pass the icons in order of preference.
  Returns:
    number of icons used, or 0 if display hasn't been created

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2006 lwjgl.org. All Rights Reserved.