Application configuration, access to GL20 and GL30 are provided here.
If supported by the backend, this interface lets you query the available display modes (graphics resolution and color depth) and change it.
This interface can be used to switch between continuous and non-continuous rendering (see
setContinuousRendering(boolean)), and to explicitly requestRendering().
There are many more utility classes that are not directly generated by the Graphics interfaces. See VertexArray
, VertexBufferObject, IndexBufferObject, Mesh, ShaderProgram and FrameBuffer,
BitmapFont, Batch and so on. All these classes are managed, meaning they don't need to be reloaded on a context
loss. Explore the com.badlogic.gdx.graphics package for more classes that might come in handy.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Graphics.
Class describing the bits per pixel, depth buffer precision, stencil precision and number of MSAA samples. |
| public static class | Graphics.
Describe a fullscreen display mode |
| public static enum | Graphics.
Enumeration describing different types of |
| public static class | Graphics.
Describes a monitor |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public float | |
| public int | |
| public Graphics. | getBufferFormat()
Returns: the format of the color, depth and stencil buffer in a |
| public float | |
| public float | Returns: the Density Independent Pixel factor of the display.This is a scaling factor for the Density Independent Pixel unit, following the same conventions as android.util.DisplayMetrics#density, where one DIP is one pixel on an approximately 160 dpi screen. |
| public Graphics. | |
| public Graphics. | |
| public Graphics. | |
| public Graphics. | getDisplayModes(Graphics.
Returns: the supported fullscreen |
| public long | |
| public int | |
| public GL20 | |
| public GL30 | |
| public GL31 | |
| public GL32 | |
| public GLVersion | |
| public int | |
| public Graphics. | |
| public Graphics. | |
| public float | |
| public float | |
| public float | |
| public float | |
| public Graphics. | |
| public float | getRawDeltaTime()
Deprecated
use
getDeltaTime() instead.
Returns: the time span between the current frame and the last frame in seconds, without smoothing |
| public int | getSafeInsetBottom()
Returns: the inset from the bottom which avoids display cutouts or floating gesture bars, in logical pixels |
| public int | |
| public int | |
| public int | |
| public Graphics. | |
| public int | |
| public boolean | |
| public boolean | |
| public boolean | Returns: whether OpenGL ES 3.0 is availableReturns whether OpenGL ES 3.0 is available. |
| public boolean | Returns: whether OpenGL ES 3.1 is availableReturns whether OpenGL ES 3.1 is available. |
| public boolean | Returns: whether OpenGL ES 3.2 is availableReturns whether OpenGL ES 3.2 is available. |
| public Cursor | Returns: a cursor object that can be used by callingsetCursor(Cursor) or null if not supportedthe mouse cursor image as a pixmap, int com.the x location of the hotspot pixel within the cursor image (origin top-left corner) xHotspot, int the y location of the hotspot pixel within the cursor image (origin top-left corner) yHotspot)Create a new cursor represented by the |
| public void | |
| public void | setContinuousRendering(boolean
whether the rendering should be continuous or not. isContinuous)Sets whether to render continuously. |
| public void | setCursor(Cursor
the mouse cursor as a cursor)com.Only viable on the lwjgl-backend and on the gwt-backend. |
| public void | setForegroundFPS(int
the targeted fps; default differs by platform fps)Sets the target framerate for the application when using continuous rendering. |
| public boolean | Returns: whether the operation succeeded.the display mode. displayModeSets the window to full-screen mode. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setUndecorated(boolean
true if the window border or status bar should be hidden. false otherwise. undecorated)Sets the window decoration as enabled or disabled. |
| public void | |
| public boolean | Returns: whether the operation succeededthe width in pixels width, int the height in pixels height)Sets the window to windowed mode. |
| public boolean | Returns: whether display mode changes are supported or not.Whether the given backend supports a display mode change via calling |
| public boolean |
| getBackBufferHeight | back to summary |
|---|---|
public int getBackBufferHeight()
| |
| getBackBufferScale | back to summary |
|---|---|
public float getBackBufferScale()
| |
| getBackBufferWidth | back to summary |
|---|---|
public int getBackBufferWidth()
| |
| getBufferFormat | back to summary |
|---|---|
public Graphics.
| |
| getDeltaTime | back to summary |
|---|---|
public float getDeltaTime()
| |
| getDensity | back to summary |
|---|---|
| public float getDensity() This is a scaling factor for the Density Independent Pixel unit, following the same conventions as android.util.DisplayMetrics#density, where one DIP is one pixel on an approximately 160 dpi screen. Thus on a 160dpi screen this density value will be 1; on a 120 dpi screen it would be .75; etc. If the density could not be determined, this returns a default value of 1. Depending on the underlying platform implementation this might be a relatively expensive operation. Therefore it should not be called continously on each frame.
| |
| getDisplayMode | back to summary |
|---|---|
public Graphics.
| |
| getDisplayMode | back to summary |
|---|---|
public Graphics.
| |
| getDisplayModes | back to summary |
|---|---|
public Graphics.
| |
| getDisplayModes | back to summary |
|---|---|
public Graphics.
| |
| getFrameId | back to summary |
|---|---|
| public long getFrameId() Returns the id of the current frame. The general contract of this method is that the id is incremented only when the
application is in the running state right before calling the
| |
| getFramesPerSecond | back to summary |
|---|---|
public int getFramesPerSecond()
| |
| getGL20 | back to summary |
|---|---|
| public GL20 getGL20() | |
| getGL30 | back to summary |
|---|---|
| public GL30 getGL30() | |
| getGL31 | back to summary |
|---|---|
| public GL31 getGL31() | |
| getGL32 | back to summary |
|---|---|
| public GL32 getGL32() | |
| getGLVersion | back to summary |
|---|---|
| public GLVersion getGLVersion() | |
| getHeight | back to summary |
|---|---|
public int getHeight()
| |
| getMonitor | back to summary |
|---|---|
| public Graphics. | |
| getMonitors | back to summary |
|---|---|
| public Graphics. | |
| getPpcX | back to summary |
|---|---|
public float getPpcX()
| |
| getPpcY | back to summary |
|---|---|
public float getPpcY()
| |
| getPpiX | back to summary |
|---|---|
public float getPpiX()
| |
| getPpiY | back to summary |
|---|---|
public float getPpiY()
| |
| getPrimaryMonitor | back to summary |
|---|---|
| public Graphics. | |
| getRawDeltaTime | back to summary |
|---|---|
| public float getRawDeltaTime()
Deprecated use
| |
| getSafeInsetBottom | back to summary |
|---|---|
public int getSafeInsetBottom()
| |
| getSafeInsetLeft | back to summary |
|---|---|
public int getSafeInsetLeft()
| |
| getSafeInsetRight | back to summary |
|---|---|
public int getSafeInsetRight()
| |
| getSafeInsetTop | back to summary |
|---|---|
public int getSafeInsetTop()
| |
| getType | back to summary |
|---|---|
public Graphics.
| |
| getWidth | back to summary |
|---|---|
public int getWidth()
| |
| isContinuousRendering | back to summary |
|---|---|
public boolean isContinuousRendering()
| |
| isFullscreen | back to summary |
|---|---|
| public boolean isFullscreen() Whether the app is fullscreen or not | |
| isGL30Available | back to summary |
|---|---|
| public boolean isGL30Available() Returns whether OpenGL ES 3.0 is available. If it is you can get an instance of
| |
| isGL31Available | back to summary |
|---|---|
| public boolean isGL31Available() Returns whether OpenGL ES 3.1 is available. If it is you can get an instance of
| |
| isGL32Available | back to summary |
|---|---|
| public boolean isGL32Available() Returns whether OpenGL ES 3.2 is available. If it is you can get an instance of
| |
| newCursor | back to summary |
|---|---|
| public Cursor newCursor(Pixmap pixmap, int xHotspot, int yHotspot) Create a new cursor represented by the
| |
| requestRendering | back to summary |
|---|---|
| public void requestRendering() Requests a new frame to be rendered if the rendering mode is non-continuous. This method can be called from any thread. | |
| setContinuousRendering | back to summary |
|---|---|
| public void setContinuousRendering(boolean isContinuous) Sets whether to render continuously. In case rendering is performed non-continuously, the following events will trigger a redraw:
ApplicationListener. This method can be called from any
thread.
| |
| setCursor | back to summary |
|---|---|
| public void setCursor(Cursor cursor) Only viable on the lwjgl-backend and on the gwt-backend. Browsers that support cursor:url() and support the png format (the
pixmap is converted to a data-url of type image/png) should also support custom cursors. Will set the mouse cursor image to
the image represented by the
| |
| setForegroundFPS | back to summary |
|---|---|
| public void setForegroundFPS(int fps) Sets the target framerate for the application when using continuous rendering. Might not work on all platforms. Is not generally advised to be used on mobile platforms.
| |
| setFullscreenMode | back to summary |
|---|---|
| public boolean setFullscreenMode(Graphics. Sets the window to full-screen mode.
| |
| setGL20 | back to summary |
|---|---|
| public void setGL20(GL20 gl20) Set the GL20 instance | |
| setGL30 | back to summary |
|---|---|
| public void setGL30(GL30 gl30) Set the GL30 instance | |
| setGL31 | back to summary |
|---|---|
| public void setGL31(GL31 gl31) Set the GL31 instance | |
| setGL32 | back to summary |
|---|---|
| public void setGL32(GL32 gl32) Set the GL32 instance | |
| setResizable | back to summary |
|---|---|
| public void setResizable(boolean resizable) Sets whether or not the window should be resizable. Ignored on Android. Note that immediate behavior of this method may vary depending on the implementation. It may be necessary for the window to be recreated in order for the changes to take effect. Consult the documentation for the backend in use for more information. Supported on all GDX desktop backends. | |
| setSystemCursor | back to summary |
|---|---|
| public void setSystemCursor(Cursor. Sets one of the predefined | |
| setTitle | back to summary |
|---|---|
| public void setTitle(String title) Sets the title of the window. Ignored on Android.
| |
| setUndecorated | back to summary |
|---|---|
| public void setUndecorated(boolean undecorated) Sets the window decoration as enabled or disabled. On Android, this will enable/disable the menu bar. Note that immediate behavior of this method may vary depending on the implementation. It may be necessary for the window to be recreated in order for the changes to take effect. Consult the documentation for the backend in use for more information. Supported on all GDX desktop backends and on Android (to disable the menu bar).
| |
| setVSync | back to summary |
|---|---|
| public void setVSync(boolean vsync) Enable/Disable vsynching. This is a best-effort attempt which might not work on all platforms.
| |
| setWindowedMode | back to summary |
|---|---|
| public boolean setWindowedMode(int width, int height) Sets the window to windowed mode.
| |
| supportsDisplayModeChange | back to summary |
|---|---|
| public boolean supportsDisplayModeChange() Whether the given backend supports a display mode change via calling
| |
| supportsExtension | back to summary |
|---|---|
public boolean supportsExtension(String extension)
| |
| Modifier and Type | Field and Description |
|---|---|
| public final int | |
| public final int | |
| public final boolean | coverageSampling
whether coverage sampling anti-aliasing is used. |
| public final int | |
| public final int | |
| public final int | |
| public final int | samples
number of samples for multi-sample anti-aliasing (MSAA) |
| public final int |
| Access | Constructor and Description |
|---|---|
| public | BufferFormat(int r, int g, int b, int a, int depth, int stencil, int samples, boolean coverageSampling)
|
| Modifier and Type | Method and Description |
|---|---|
| public String |
| a | back to summary |
|---|---|
| public final int a | |
| b | back to summary |
|---|---|
| public final int b | |
| coverageSampling | back to summary |
|---|---|
| public final boolean coverageSampling whether coverage sampling anti-aliasing is used. in that case you have to clear the coverage buffer as well! | |
| depth | back to summary |
|---|---|
| public final int depth | |
| g | back to summary |
|---|---|
| public final int g | |
| r | back to summary |
|---|---|
| public final int r | |
| samples | back to summary |
|---|---|
| public final int samples number of samples for multi-sample anti-aliasing (MSAA) | |
| stencil | back to summary |
|---|---|
| public final int stencil | |
| BufferFormat | back to summary |
|---|---|
| public BufferFormat(int r, int g, int b, int a, int depth, int stencil, int samples, boolean coverageSampling) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| public final int | bitsPerPixel
the number of bits per pixel, may exclude alpha |
| public final int | height
the height in physical pixels |
| public final int | refreshRate
the refresh rate in Hertz |
| public final int | width
the width in physical pixels |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public String |
| bitsPerPixel | back to summary |
|---|---|
| public final int bitsPerPixel the number of bits per pixel, may exclude alpha | |
| height | back to summary |
|---|---|
| public final int height the height in physical pixels | |
| refreshRate | back to summary |
|---|---|
| public final int refreshRate the refresh rate in Hertz | |
| width | back to summary |
|---|---|
| public final int width the width in physical pixels | |
| DisplayMode | back to summary |
|---|---|
| protected DisplayMode(int width, int height, int refreshRate, int bitsPerPixel) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
Graphics implementations.
| Modifier and Type | Field and Description |
|---|---|
| public static final Graphics. | |
| public static final Graphics. | |
| public static final Graphics. | |
| public static final Graphics. | |
| public static final Graphics. | |
| public static final Graphics. | |
| public static final Graphics. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Graphics. | |
| public static Graphics. |
| AndroidGL | back to summary |
|---|---|
| public static final Graphics. | |
| iOSGL | back to summary |
|---|---|
| public static final Graphics. | |
| JGLFW | back to summary |
|---|---|
| public static final Graphics. | |
| LWJGL | back to summary |
|---|---|
| public static final Graphics. | |
| LWJGL3 | back to summary |
|---|---|
| public static final Graphics. | |
| Mock | back to summary |
|---|---|
| public static final Graphics. | |
| WebGL | back to summary |
|---|---|
| public static final Graphics. | |
| GraphicsType | back to summary |
|---|---|
| private GraphicsType() | |
| valueOf | back to summary |
|---|---|
| public static Graphics. | |
| values | back to summary |
|---|---|
| public static Graphics. | |
| Modifier and Type | Field and Description |
|---|---|
| public final String | |
| public final int | |
| public final int |
| Access | Constructor and Description |
|---|---|
| protected |
| name | back to summary |
|---|---|
| public final String name | |
| virtualX | back to summary |
|---|---|
| public final int virtualX | |
| virtualY | back to summary |
|---|---|
| public final int virtualY | |
| Monitor | back to summary |
|---|---|
| protected Monitor(int virtualX, int virtualY, String name) | |