Top Fields Constructors Methods
org.lwjgl.opengl

public final Class Display

extends Object
Class Inheritance
Imports
org.lwjgl.BufferUtils, .LWJGLException, .LWJGLUtil, .Sys, org.lwjgl.input.Controllers, .Keyboard, .Mouse, java.awt.*, java.awt.event.ComponentAdapter, .ComponentEvent, .ComponentListener, java.nio.ByteBuffer, .FloatBuffer, java.security.AccessController, .PrivilegedAction, java.util.Arrays, .HashSet

Field Summary

Modifier and TypeField and Description
private static float
b

Initial Background Color of Display

private static ByteBuffer[]
cached_icons

Cached window icons, for when Display is recreated

private static final ComponentListener
private static DisplayMode
current_mode

The current display mode, if created

private static final DisplayImplementation
display_impl

The display implementor

private static DrawableLWJGL
drawable

The Drawable instance that tracks the current Display context

private static boolean
fullscreen

Fullscreen

private static float
g

Initial Background Color of Display

private static int
height

the height of the Display window

private static final DisplayMode
initial_mode

The initial display mode

private static Canvas
parent

The parent, if any

private static boolean
private static float
r

Initial Background Color of Display

private static final Thread
private static int
swap_interval

Swap interval

private static String
title

Title of the window (never null)

private static int
width

the width of the Display window

private static boolean
private static boolean
private static boolean
private static int
x

X coordinate of the window

private static int
y

Y coordinate of the window.

Constructor Summary

AccessConstructor and Description
private
Display()

Only constructed by ourselves

Method Summary

Modifier and TypeMethod and Description
public static void
create()

Create the OpenGL context.

public static void
create(PixelFormat
Describes the minimum specifications the context must fulfill.
pixel_format
)

Create the OpenGL context with the given minimum parameters.

public static void
create(PixelFormat
Describes the minimum specifications the context must fulfill.
pixel_format
,
Drawable
The Drawable to share context with. (optional, may be null)
shared_drawable
)

Create the OpenGL context with the given minimum parameters.

public static void
create(PixelFormat
Describes the minimum specifications the context must fulfill.
pixel_format
,
ContextAttribs
The ContextAttribs to use when creating the context. (optional, may be null)
attribs
)

Create the OpenGL context with the given minimum parameters.

public static void
create(PixelFormat
Describes the minimum specifications the context must fulfill.
pixel_format
,
Drawable
The Drawable to share context with. (optional, may be null)
shared_drawable
,
ContextAttribs
The ContextAttribs to use when creating the context. (optional, may be null)
attribs
)

Create the OpenGL context with the given minimum parameters.

public static void
create(PixelFormatLWJGL
Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.
pixel_format
)

Create the OpenGL ES context with the given minimum parameters.

public static void
create(PixelFormatLWJGL
Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.
pixel_format
,
Drawable
The Drawable to share context with. (optional, may be null)
shared_drawable
)

Create the OpenGL ES context with the given minimum parameters.

public static void
create(PixelFormatLWJGL
Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.
pixel_format
,
ContextAttribs
The ContextAttribs to use when creating the context. (optional, may be null)
attribs
)

Create the OpenGL ES context with the given minimum parameters.

public static void
create(PixelFormatLWJGL
Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.
pixel_format
,
Drawable
The Drawable to share context with. (optional, may be null)
shared_drawable
,
ContextAttribs
The ContextAttribs to use when creating the context. (optional, may be null)
attribs
)

Create the OpenGL ES context with the given minimum parameters.

private static DisplayImplementation
private static void
createWindow()

Create the native window peer from the given mode and fullscreen flag.

public static void
destroy()

Destroy the Display.

private static void
public static String

Returns:

a String
getAdapter
()

Get the driver adapter string.

public static DisplayMode[]

Returns:

an array of all display modes the system reckons it can handle.
getAvailableDisplayModes
()

Returns the entire list of possible fullscreen display modes as an array, in no particular order.

public static DisplayMode

Returns:

The desktop display mode
getDesktopDisplayMode
()

Return the initial desktop display mode.

public static DisplayMode

Returns:

The current display mode
getDisplayMode
()

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

public static Drawable

Returns:

the Drawable corresponding to the Display context
getDrawable
()

Fetch the Drawable from the Display.

private static DisplayMode
public static int

Returns:

this method will return the height of the Display window. If running in fullscreen mode it will return the height of the current set DisplayMode. If Display.setParent(Canvas parent) is being used, the height of the parent will be returned. This value will be updated after a call to Display.update().
getHeight
()

pack-priv static DisplayImplementation
public static Canvas
getParent()

Return the last parent set with setParent().

public static float

Returns:

this method will return the pixel scale factor of the Display window. This method should be used when running in high DPI mode. In such modes Operating Systems will scale the Display window to avoid the window shrinking due to high resolutions. The OpenGL frame buffer will however use the higher resolution and not be scaled to match the Display window size. OpenGL methods that require pixel dependent values e.g. glViewport, glTexImage2D, glReadPixels, glScissor, glLineWidth, glRenderbufferStorage, etc can convert the scaled Display and Mouse coordinates to the correct high resolution value by multiplying them by the pixel scale factor. e.g. Display.getWidth() * Display.getPixelScaleFactor() will return the high DPI width of the OpenGL frame buffer. Whereas Display.getWidth() will be the same as the OpenGL frame buffer in non high DPI mode. Where high DPI mode is not available this method will just return 1.0f therefore not have any effect on values that are multiplied by it.
getPixelScaleFactor
()

pack-priv static boolean
getPrivilegedBoolean(final String property_name)

Gets a boolean property as a privileged action.

pack-priv static String
getPrivilegedString(final String property_name)

Gets a string property as a privileged action.

public static String

Returns:

the title of the window
getTitle
()

public static String

Returns:

a String
getVersion
()

Get the driver version.

public static int

Returns:

this method will return the width of the Display window. If running in fullscreen mode it will return the width of the current set DisplayMode. If Display.setParent(Canvas parent) is being used, the width of the parent will be returned. This value will be updated after a call to Display.update().
getWidth
()

private static int
private static int
public static int

Returns:

this method will return the x position (top-left) of the Display window. If running in fullscreen mode it will return 0. If Display.setParent(Canvas parent) is being used, the x position of the parent will be returned.
getX
()

public static int

Returns:

this method will return the y position (top-left) of the Display window. If running in fullscreen mode it will return 0. If Display.setParent(Canvas parent) is being used, the y position of the parent will be returned.
getY
()

private static void
private static void
public static boolean

Returns:

true if window is active, that is, the foreground display of the operating system.
isActive
()

public static boolean

Returns:

true if the user or operating system has asked the window to close
isCloseRequested
()

public static boolean

Returns:

true if the window's native peer has been created
isCreated
()

public static boolean
isCurrent()

Returns true if the Display's context is current in the current thread.

public static boolean

Returns:

true if the window has been damaged by external changes and needs to repaint itself
isDirty
()

Determine if the window's contents have been damaged by external events.

public static boolean

Returns:

whether the Display is in fullscreen mode
isFullscreen
()

public static boolean

Returns:

true if the Display window is resizable.
isResizable
()

public static boolean

Returns:

true if the window is visible, false if not
isVisible
()

public static void
makeCurrent()

Make the Display the current rendering context for GL calls.

private static void
pack-priv static void
public static void
processMessages()

Process operating system events.

private static void
public static void
releaseContext()

Release the Display context.

private static void
private static void
private static void
private static void
public static void
setDisplayConfiguration(float
The gamma value
gamma
,
float
The brightness value between -1.0 and 1.0, inclusive
brightness
,
float
The contrast, larger than 0.0.
contrast
)

Set the display configuration to the specified gamma, brightness and contrast.

public static void
setDisplayMode(DisplayMode
The new display mode to set
mode
)

Set the current display mode.

public static void
setDisplayModeAndFullscreen(DisplayMode
The new display mode to set. Must be non-null.
mode
)

Set the mode of the context.

private static void
public static void
setFullscreen(boolean
Specify the fullscreen mode of the context.
fullscreen
)

Set the fullscreen mode of the context.

public static int

Returns:

number of icons used, or 0 if display hasn't been created
setIcon
(ByteBuffer[]
Array of icons in RGBA mode. Pass the icons in order of preference.
icons
)

Sets one or more icons for the Display.

public static void
setInitialBackground(float
- color value between 0 - 1
red
,
float
- color value between 0 - 1
green
,
float
- color value between 0 - 1
blue
)

Set the initial color of the Display.

public static void
setLocation(int
The new window location on the x axis
new_x
,
int
The new window location on the y axis
new_y
)

Set the window's location.

public static void
setParent(Canvas parent)

Set the parent of the Display.

public static void
setResizable(boolean
set to true to make the Display window resizable; false to disable resizing on the Display window.
resizable
)

Enable or disable the Display window to be resized.

public static void
setSwapInterval(int
The swap interval in frames, 0 to disable
value
)

Set the buffer swap interval.

public static void
setTitle(String
The new window title
newTitle
)

Set the title of the window.

public static void
setVSyncEnabled(boolean
true to synchronize; false to ignore synchronization
sync
)

Enable or disable vertical monitor synchronization.

public static void
swapBuffers()

Swap the display buffers.

private static void
public static void
sync(int
- the desired frame rate, in frames per second
fps
)

An accurate sync method that will attempt to run at a constant frame rate.

public static void
update()

Update the window.

public static void
update(boolean
Poll input devices if true
processMessages
)

Update the window.

public static boolean

Returns:

true if the Display window has been resized. This value will be updated after a call to Display.update(). This will return false if running in fullscreen or with Display.setParent(Canvas parent)
wasResized
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bback to summary
private static float b

Initial Background Color of Display

cached_iconsback to summary
private static ByteBuffer[] cached_icons

Cached window icons, for when Display is recreated

component_listenerback to summary
private static final ComponentListener component_listener
current_modeback to summary
private static DisplayMode current_mode

The current display mode, if created

display_implback to summary
private static final DisplayImplementation display_impl

The display implementor

drawableback to summary
private static DrawableLWJGL drawable

The Drawable instance that tracks the current Display context

fullscreenback to summary
private static boolean fullscreen

Fullscreen

gback to summary
private static float g

Initial Background Color of Display

heightback to summary
private static int height

the height of the Display window

initial_modeback to summary
private static final DisplayMode initial_mode

The initial display mode

parentback to summary
private static Canvas parent

The parent, if any

parent_resizedback to summary
private static boolean parent_resized
rback to summary
private static float r

Initial Background Color of Display

shutdown_hookback to summary
private static final Thread shutdown_hook
swap_intervalback to summary
private static int swap_interval

Swap interval

titleback to summary
private static String title

Title of the window (never null)

widthback to summary
private static int width

the width of the Display window

window_createdback to summary
private static boolean window_created
window_resizableback to summary
private static boolean window_resizable
window_resizedback to summary
private static boolean window_resized
xback to summary
private static int x

X coordinate of the window

yback to summary
private static int y

Y coordinate of the window. Y in window coordinates is from the top of the display down, unlike GL, where it is typically at the bottom of the display.

Constructor Detail

Displayback to summary
private Display()

Only constructed by ourselves

Method Detail

createback to summary
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.

createback to summary
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:PixelFormat

Describes the minimum specifications the context must fulfill.

createback to summary
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:PixelFormat

Describes the minimum specifications the context must fulfill.

shared_drawable:Drawable

The Drawable to share context with. (optional, may be null)

createback to summary
public static void create(PixelFormat pixel_format, ContextAttribs attribs) 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:PixelFormat

Describes the minimum specifications the context must fulfill.

attribs:ContextAttribs

The ContextAttribs to use when creating the context. (optional, may be null)

createback to summary
public static void create(PixelFormat pixel_format, Drawable shared_drawable, ContextAttribs attribs) 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:PixelFormat

Describes the minimum specifications the context must fulfill.

shared_drawable:Drawable

The Drawable to share context with. (optional, may be null)

attribs:ContextAttribs

The ContextAttribs to use when creating the context. (optional, may be null)

createback to summary
public static void create(PixelFormatLWJGL pixel_format) throws LWJGLException

Create the OpenGL ES 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:PixelFormatLWJGL

Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.

createback to summary
public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable) throws LWJGLException

Create the OpenGL ES 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:PixelFormatLWJGL

Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.

shared_drawable:Drawable

The Drawable to share context with. (optional, may be null)

createback to summary
public static void create(PixelFormatLWJGL pixel_format, ContextAttribs attribs) throws LWJGLException

Create the OpenGL ES 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:PixelFormatLWJGL

Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.

attribs:ContextAttribs

The ContextAttribs to use when creating the context. (optional, may be null)

createback to summary
public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException

Create the OpenGL ES 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:PixelFormatLWJGL

Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.

shared_drawable:Drawable

The Drawable to share context with. (optional, may be null)

attribs:ContextAttribs

The ContextAttribs to use when creating the context. (optional, may be null)

createDisplayImplementationback to summary
private static DisplayImplementation createDisplayImplementation()
createWindowback to summary
private static void createWindow() throws LWJGLException

Create the native window peer from the given mode and fullscreen flag. A native context must exist, and it will be attached to the window.

destroyback to summary
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.

destroyWindowback to summary
private static void destroyWindow()
getAdapterback to summary
public static 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:String

a String

getAvailableDisplayModesback to summary
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:DisplayMode[]

an array of all display modes the system reckons it can handle.

getDesktopDisplayModeback to summary
public static DisplayMode getDesktopDisplayMode()

Return the initial desktop display mode.

Returns:DisplayMode

The desktop display mode

getDisplayModeback to summary
public static DisplayMode getDisplayMode()

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

Returns:DisplayMode

The current display mode

getDrawableback to summary
public static Drawable getDrawable()

Fetch the Drawable from the Display.

Returns:Drawable

the Drawable corresponding to the Display context

getEffectiveModeback to summary
private static DisplayMode getEffectiveMode()
getHeightback to summary
public static int getHeight()
Returns:int

this method will return the height of the Display window. If running in fullscreen mode it will return the height of the current set DisplayMode. If Display.setParent(Canvas parent) is being used, the height of the parent will be returned. This value will be updated after a call to Display.update().

getImplementationback to summary
pack-priv static DisplayImplementation getImplementation()
getParentback to summary
public static Canvas getParent()

Return the last parent set with setParent().

getPixelScaleFactorback to summary
public static float getPixelScaleFactor()
Returns:float

this method will return the pixel scale factor of the Display window. This method should be used when running in high DPI mode. In such modes Operating Systems will scale the Display window to avoid the window shrinking due to high resolutions. The OpenGL frame buffer will however use the higher resolution and not be scaled to match the Display window size. OpenGL methods that require pixel dependent values e.g. glViewport, glTexImage2D, glReadPixels, glScissor, glLineWidth, glRenderbufferStorage, etc can convert the scaled Display and Mouse coordinates to the correct high resolution value by multiplying them by the pixel scale factor. e.g. Display.getWidth() * Display.getPixelScaleFactor() will return the high DPI width of the OpenGL frame buffer. Whereas Display.getWidth() will be the same as the OpenGL frame buffer in non high DPI mode. Where high DPI mode is not available this method will just return 1.0f therefore not have any effect on values that are multiplied by it.

getPrivilegedBooleanback to summary
pack-priv static boolean getPrivilegedBoolean(final String property_name)

Gets a boolean property as a privileged action.

getPrivilegedStringback to summary
pack-priv static String getPrivilegedString(final String property_name)

Gets a string property as a privileged action.

getTitleback to summary
public static String getTitle()
Returns:String

the title of the window

getVersionback to summary
public static 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:String

a String

getWidthback to summary
public static int getWidth()
Returns:int

this method will return the width of the Display window. If running in fullscreen mode it will return the width of the current set DisplayMode. If Display.setParent(Canvas parent) is being used, the width of the parent will be returned. This value will be updated after a call to Display.update().

getWindowXback to summary
private static int getWindowX()
getWindowYback to summary
private static int getWindowY()
getXback to summary
public static int getX()
Returns:int

this method will return the x position (top-left) of the Display window. If running in fullscreen mode it will return 0. If Display.setParent(Canvas parent) is being used, the x position of the parent will be returned.

getYback to summary
public static int getY()
Returns:int

this method will return the y position (top-left) of the Display window. If running in fullscreen mode it will return 0. If Display.setParent(Canvas parent) is being used, the y position of the parent will be returned.

initContextback to summary
private static void initContext()
initControlsback to summary
private static void initControls()
isActiveback to summary
public static boolean isActive()
Returns:boolean

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

isCloseRequestedback to summary
public static boolean isCloseRequested()
Returns:boolean

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

isCreatedback to summary
public static boolean isCreated()
Returns:boolean

true if the window's native peer has been created

isCurrentback to summary
public static boolean isCurrent() throws LWJGLException

Returns true if the Display's context is current in the current thread.

isDirtyback to summary
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:boolean

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

isFullscreenback to summary
public static boolean isFullscreen()
Returns:boolean

whether the Display is in fullscreen mode

isResizableback to summary
public static boolean isResizable()
Returns:boolean

true if the Display window is resizable.

isVisibleback to summary
public static boolean isVisible()
Returns:boolean

true if the window is visible, false if not

makeCurrentback to summary
public static void makeCurrent() throws LWJGLException

Make the Display the current rendering context for GL calls.

Exceptions
LWJGLException:
If the context could not be made current
makeCurrentAndSetSwapIntervalback to summary
private static void makeCurrentAndSetSwapInterval() throws LWJGLException
pollDevicesback to summary
pack-priv static void pollDevices()
processMessagesback to summary
public static void processMessages()

Process operating system events. Call this to update the Display's state and to receive new input device events. This method is called from update(), so it is not necessary to call this method if update() is called periodically.

registerShutdownHookback to summary
private static void registerShutdownHook()
releaseContextback to summary
public static void releaseContext() throws LWJGLException

Release the Display context.

Exceptions
LWJGLException:
If the context could not be released
releaseDrawableback to summary
private static void releaseDrawable()
removeShutdownHookback to summary
private static void removeShutdownHook()
resetback to summary
private static void reset()
reshapeback to summary
private static void reshape()
setDisplayConfigurationback to summary
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:float

The gamma value

brightness:float

The brightness value between -1.0 and 1.0, inclusive

contrast:float

The contrast, larger than 0.0.

setDisplayModeback to summary
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:DisplayMode

The new display mode to set

Exceptions
LWJGLException:
if the display mode could not be set
setDisplayModeAndFullscreenback to summary
public static void setDisplayModeAndFullscreen(DisplayMode mode) throws LWJGLException

Set the mode of the context. If no context has been created through create(), the mode will apply when create() is called. If mode.isFullscreenCapable() is true, the context will become a fullscreen context and the display mode is switched to the mode given by getDisplayMode(). If mode.isFullscreenCapable() 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
mode:DisplayMode

The new display mode to set. Must be non-null.

Exceptions
LWJGLException:
If the mode switch fails.
setDisplayModeAndFullscreenInternalback to summary
private static void setDisplayModeAndFullscreenInternal(boolean fullscreen, DisplayMode mode) throws LWJGLException
setFullscreenback to summary
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:boolean

Specify the fullscreen mode of the context.

Exceptions
LWJGLException:
If fullscreen is true, and the current DisplayMode instance is not from getAvailableDisplayModes() or if the mode switch fails.
setIconback to summary
public static int setIcon(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 (size must be a power of two) 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:ByteBuffer[]

Array of icons in RGBA mode. Pass the icons in order of preference.

Returns:int

number of icons used, or 0 if display hasn't been created

setInitialBackgroundback to summary
public static void setInitialBackground(float red, float green, float blue)

Set the initial color of the Display. This method is called before the Display is created and will set the background color to the one specified in this method.

Parameters
red:float

- color value between 0 - 1

green:float

- color value between 0 - 1

blue:float

- color value between 0 - 1

setLocationback to summary
public static void setLocation(int new_x, int new_y)

Set the window's location. This is a no-op on fullscreen windows or when getParent() != null. 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

Note

If no location has been specified (or x == y == -1) the window will be centered

Parameters
new_x:int

The new window location on the x axis

new_y:int

The new window location on the y axis

setParentback to summary
public static void setParent(Canvas parent) throws LWJGLException

Set the parent of the Display. If parent is null, the Display will appear as a top level window. If parent is not null, the Display is made a child of the parent. A parent's isDisplayable() must be true when setParent() is called and remain true until setParent() is called again with null or a different parent. This generally means that the parent component must remain added to it's parent container.

It is not advisable to call this method from an AWT thread, since the context will be made current on the thread and it is difficult to predict which AWT thread will process any given AWT event.

While the Display is in fullscreen mode, the current parent will be ignored. Additionally, when a non null parent is specified, the Dispaly will inherit the size of the parent, disregarding the currently set display mode.

setResizableback to summary
public static void setResizable(boolean resizable)

Enable or disable the Display window to be resized.

Parameters
resizable:boolean

set to true to make the Display window resizable; false to disable resizing on the Display window.

setSwapIntervalback to summary
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
value:int

The swap interval in frames, 0 to disable

setTitleback to summary
public static void setTitle(String newTitle)

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

Parameters
newTitle:String

The new window title

setVSyncEnabledback to summary
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:boolean

true to synchronize; false to ignore synchronization

swapBuffersback to summary
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.

Exceptions
OpenGLException:
if an OpenGL error has occured since the last call to glGetError()
switchDisplayModeback to summary
private static void switchDisplayMode() throws LWJGLException
syncback to summary
public static void sync(int fps)

An accurate sync method that will attempt to run at a constant frame rate. It should be called once every frame.

Parameters
fps:int

- the desired frame rate, in frames per second

updateback to summary
public static void update()

Update the window. If the window is visible clears the dirty flag and calls swapBuffers() and finally polls the input devices.

updateback to summary
public static void update(boolean processMessages)

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

Parameters
processMessages:boolean

Poll input devices if true

wasResizedback to summary
public static boolean wasResized()
Returns:boolean

true if the Display window has been resized. This value will be updated after a call to Display.update(). This will return false if running in fullscreen or with Display.setParent(Canvas parent)