public final class Display
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
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,
ContextAttribs attribs)
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 |
create(PixelFormat pixel_format,
Drawable shared_drawable,
ContextAttribs attribs)
Create the OpenGL context with the given minimum parameters.
|
static void |
create(PixelFormatLWJGL pixel_format)
Create the OpenGL ES context with the given minimum parameters.
|
static void |
create(PixelFormatLWJGL pixel_format,
ContextAttribs attribs)
Create the OpenGL ES context with the given minimum parameters.
|
static void |
create(PixelFormatLWJGL pixel_format,
Drawable shared_drawable)
Create the OpenGL ES context with the given minimum parameters.
|
static void |
create(PixelFormatLWJGL pixel_format,
Drawable shared_drawable,
ContextAttribs attribs)
Create the OpenGL ES 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 |
getDesktopDisplayMode()
Return the initial desktop display mode.
|
static DisplayMode |
getDisplayMode()
Return the current display mode, as set by setDisplayMode().
|
static Drawable |
getDrawable()
Fetch the Drawable from the Display.
|
static int |
getHeight() |
static java.awt.Canvas |
getParent()
Return the last parent set with setParent().
|
static float |
getPixelScaleFactor() |
static java.lang.String |
getTitle() |
static java.lang.String |
getVersion()
Get the driver version.
|
static int |
getWidth() |
static int |
getX() |
static int |
getY() |
static boolean |
isActive() |
static boolean |
isCloseRequested() |
static boolean |
isCreated() |
static boolean |
isCurrent()
Returns true if the Display's context is current in the current thread.
|
static boolean |
isDirty()
Determine if the window's contents have been damaged by external events.
|
static boolean |
isFullscreen() |
static boolean |
isResizable() |
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 |
setDisplayModeAndFullscreen(DisplayMode mode)
Set the mode of the context.
|
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 |
setInitialBackground(float red,
float green,
float blue)
Set the initial color of the Display.
|
static void |
setLocation(int new_x,
int new_y)
Set the window's location.
|
static void |
setParent(java.awt.Canvas parent)
Set the parent of the Display.
|
static void |
setResizable(boolean resizable)
Enable or disable the Display window to be resized.
|
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)
An accurate sync method that will attempt to run at a constant frame rate.
|
static void |
update()
Update the window.
|
static void |
update(boolean processMessages)
Update the window.
|
static boolean |
wasResized() |
public static Drawable getDrawable()
public static DisplayMode[] getAvailableDisplayModes() throws LWJGLException
LWJGLException
public static DisplayMode getDesktopDisplayMode()
public static DisplayMode getDisplayMode()
public static void setDisplayMode(DisplayMode mode) throws LWJGLException
mode
- The new display mode to setLWJGLException
- if the display mode could not be setpublic static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException
gamma
- The gamma valuebrightness
- The brightness value between -1.0 and 1.0, inclusivecontrast
- The contrast, larger than 0.0.LWJGLException
public static void sync(int fps)
fps
- - the desired frame rate, in frames per secondpublic static java.lang.String getTitle()
public static java.awt.Canvas getParent()
public static void setParent(java.awt.Canvas parent) throws LWJGLException
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.
LWJGLException
public static void setFullscreen(boolean fullscreen) throws LWJGLException
fullscreen
- Specify the fullscreen mode of the context.LWJGLException
- If fullscreen is true, and the current DisplayMode instance is not
from getAvailableDisplayModes() or if the mode switch fails.public static void setDisplayModeAndFullscreen(DisplayMode mode) throws LWJGLException
mode
- The new display mode to set. Must be non-null.LWJGLException
- If the mode switch fails.public static boolean isFullscreen()
public static void setTitle(java.lang.String newTitle)
newTitle
- The new window titlepublic static boolean isCloseRequested()
public static boolean isVisible()
public static boolean isActive()
public static boolean isDirty()
public static void processMessages()
public static void swapBuffers() throws LWJGLException
OpenGLException
- if an OpenGL error has occured since the last call to glGetError()LWJGLException
public static void update()
public static void update(boolean processMessages)
processMessages
- Poll input devices if truepublic static void releaseContext() throws LWJGLException
LWJGLException
- If the context could not be releasedpublic static boolean isCurrent() throws LWJGLException
LWJGLException
public static void makeCurrent() throws LWJGLException
LWJGLException
- If the context could not be made currentpublic static void create() throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
LWJGLException
public static void create(PixelFormat pixel_format) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill.LWJGLException
public static void create(PixelFormat pixel_format, Drawable shared_drawable) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill.shared_drawable
- The Drawable to share context with. (optional, may be null)LWJGLException
public static void create(PixelFormat pixel_format, ContextAttribs attribs) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill.attribs
- The ContextAttribs to use when creating the context. (optional, may be null)LWJGLException
public static void create(PixelFormat pixel_format, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill.shared_drawable
- The Drawable to share context with. (optional, may be null)attribs
- The ContextAttribs to use when creating the context. (optional, may be null)LWJGLException
public static void create(PixelFormatLWJGL pixel_format) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.LWJGLException
public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.shared_drawable
- The Drawable to share context with. (optional, may be null)LWJGLException
public static void create(PixelFormatLWJGL pixel_format, ContextAttribs attribs) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.attribs
- The ContextAttribs to use when creating the context. (optional, may be null)LWJGLException
public static void create(PixelFormatLWJGL pixel_format, Drawable shared_drawable, ContextAttribs attribs) throws LWJGLException
The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
pixel_format
- Describes the minimum specifications the context must fulfill. Must be an instance of org.lwjgl.opengles.PixelFormat.shared_drawable
- The Drawable to share context with. (optional, may be null)attribs
- The ContextAttribs to use when creating the context. (optional, may be null)LWJGLException
public static void setInitialBackground(float red, float green, float blue)
red
- - color value between 0 - 1green
- - color value between 0 - 1blue
- - color value between 0 - 1public static void destroy()
public static boolean isCreated()
public static void setSwapInterval(int value)
value
- The swap interval in frames, 0 to disablepublic static void setVSyncEnabled(boolean sync)
sync
- true to synchronize; false to ignore synchronizationpublic static void setLocation(int new_x, int new_y)
new_x
- The new window location on the x axisnew_y
- The new window location on the y axispublic static java.lang.String getAdapter()
public static java.lang.String getVersion()
public static int setIcon(java.nio.ByteBuffer[] icons)
icons
- Array of icons in RGBA mode. Pass the icons in order of preference.public static void setResizable(boolean resizable)
resizable
- set to true to make the Display window resizable;
false to disable resizing on the Display window.public static boolean isResizable()
public static boolean wasResized()
public static int getX()
public static int getY()
public static int getWidth()
public static int getHeight()
public static float getPixelScaleFactor()
Copyright © 2002-2009 lwjgl.org. All Rights Reserved.