|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graphics
This interface encapsulates communication with the graphics processor. Depending on the available hardware and the current
Application
configuration, access to the GL10
, GL11
, GL20
, and/or GLCommon
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
, SpriteBatch
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.
Nested Class Summary | |
---|---|
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. |
Method Summary | |
---|---|
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()
|
GL10 |
getGL10()
|
GL11 |
getGL11()
|
GL20 |
getGL20()
|
GLCommon |
getGLCommon()
|
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 |
isGL11Available()
Returns whether OpenGL ES 1.1 is available. |
boolean |
isGL20Available()
Returns whether OpenGL ES 2.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)
|
Method Detail |
---|
boolean isGL11Available()
GL11
via getGL11()
to
access OpenGL ES 1.1 functionality. This also implies that getGL10()
will return an instance.
boolean isGL20Available()
GL20
via getGL20()
to
access OpenGL ES 2.0 functionality. Note that this functionality will only be available if you instructed the
Application
instance to use OpenGL ES 2.0!
GLCommon getGLCommon()
GLCommon
instanceGL10 getGL10()
GL10
instance or null if not supportedGL11 getGL11()
GL11
instance or null if not supportedGL20 getGL20()
GL20
instance or null if not supportedint 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 name
void 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |