public interface Graphics
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 | Interface and Description |
---|---|
static class |
Graphics.BufferFormat
Class describing the bits per pixel, depth buffer precision, stencil precision and number of MSAA samples.
|
static class |
Graphics.DisplayMode
Describe a fullscreen display mode
|
static class |
Graphics.GraphicsType
Enumeration describing different types of
Graphics implementations. |
Modifier and Type | Method and Description |
---|---|
Graphics.BufferFormat |
getBufferFormat() |
float |
getDeltaTime() |
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.
|
Graphics.DisplayMode |
getDesktopDisplayMode() |
Graphics.DisplayMode[] |
getDisplayModes() |
int |
getFramesPerSecond() |
GL20 |
getGL20() |
GL30 |
getGL30() |
int |
getHeight() |
float |
getPpcX() |
float |
getPpcY() |
float |
getPpiX() |
float |
getPpiY() |
float |
getRawDeltaTime() |
Graphics.GraphicsType |
getType() |
int |
getWidth() |
boolean |
isContinuousRendering() |
boolean |
isFullscreen()
Whether the app is fullscreen or not
|
boolean |
isGL30Available()
Returns whether OpenGL ES 3.0 is available.
|
void |
requestRendering()
Requests a new frame to be rendered if the rendering mode is non-continuous.
|
void |
setContinuousRendering(boolean isContinuous)
Sets whether to render continuously.
|
boolean |
setDisplayMode(Graphics.DisplayMode displayMode)
Sets the current
Graphics.DisplayMode . |
boolean |
setDisplayMode(int width,
int height,
boolean fullscreen)
Tries to set the display mode width the given width and height in pixels.
|
void |
setTitle(String title)
Sets the title of the window.
|
void |
setVSync(boolean vsync)
Enable/Disable vsynching.
|
boolean |
supportsDisplayModeChange()
Whether the given backend supports a display mode change via calling
setDisplayMode(DisplayMode) |
boolean |
supportsExtension(String extension) |
boolean isGL30Available()
GL30
via getGL30()
to
access OpenGL ES 3.0 functionality. Note that this functionality will only be available if you instructed the
Application
instance to use OpenGL ES 3.0!int getWidth()
int getHeight()
float getDeltaTime()
float getRawDeltaTime()
int getFramesPerSecond()
Graphics.GraphicsType getType()
Graphics.GraphicsType
of this Graphics instancefloat getPpiX()
float getPpiY()
float getPpcX()
float getPpcY()
float getDensity()
boolean supportsDisplayModeChange()
setDisplayMode(DisplayMode)
Graphics.DisplayMode[] getDisplayModes()
Graphics.DisplayMode
(s).Graphics.DisplayMode getDesktopDisplayMode()
boolean setDisplayMode(Graphics.DisplayMode displayMode)
Graphics.DisplayMode
. Returns false in case the operation failed. Not all backends support this method. See
supportsDisplayModeChange()
.displayMode
- the display mode.boolean setDisplayMode(int width, int height, boolean fullscreen)
getDisplayModes()
to get a list of
supported fullscreen modes.width
- the width in pixelsheight
- the height in pixelsfullscreen
- whether to use fullscreen rendering or notvoid setTitle(String title)
title
- the title.void setVSync(boolean vsync)
vsync
- vsync enabled or not.Graphics.BufferFormat getBufferFormat()
Graphics.BufferFormat
instanceboolean supportsExtension(String extension)
extension
- the extension namevoid setContinuousRendering(boolean isContinuous)
requestRendering()
Runnable
is posted to the rendering thread via Application.postRunnable(Runnable)
ApplicationListener
. This method can be called from any
thread.isContinuous
- whether the rendering should be continuous or not.boolean isContinuousRendering()
void requestRendering()
boolean isFullscreen()
Copyright © 2014. All Rights Reserved.