|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Graphics
This interface encapsulates the communication with the graphics processor. It allows to retrieve GL10
, GL11
and
GL20
instances depending on the available hardware and configuration of the Application
. Additionally it
features methods to generate Pixmap
s and Texture
s.
Texture
s can be either managed or not managed. Managed and Textures will be restored when the OpenGL context is lost.
An OpenGL ES context loss happens when a user pauses the Application ( ApplicationListener.pause()
) and switches to
another application on Android. On the desktop there is no concept of context loss for OpenGL.
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.
All graphical resources, be the generated by the Graphics
interface or via a constructor must be disposed when
no longer used!
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
Class describing 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()
|
GLU |
getGLU()
|
int |
getHeight()
|
float |
getPpcX()
|
float |
getPpcY()
|
float |
getPpiX()
|
float |
getPpiY()
|
Graphics.GraphicsType |
getType()
|
int |
getWidth()
|
boolean |
isGL11Available()
Returns whether OpenGL ES 1.1 is available. |
boolean |
isGL20Available()
Returns whether OpenGL ES 2.0 is available. |
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 |
setIcon(Pixmap[] pixmaps)
Sets one or more icons for the Desktop. |
void |
setTitle(java.lang.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(java.lang.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 supportedGLU getGLU()
GLU
instanceint getWidth()
int getHeight()
float getDeltaTime()
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
.Graphics.DisplayMode getDesktopDisplayMode()
boolean setDisplayMode(Graphics.DisplayMode displayMode)
Graphics.DisplayMode
. Returns false in case the operation failed. Not all backends support this methods. 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(java.lang.String title)
title
- the title.void setIcon(Pixmap[] pixmaps)
pixmaps
- 1 or more Pixmaps using Pixmap.Format.RGBA8888
void setVSync(boolean vsync)
vsync
- vsync enabled or not.Graphics.BufferFormat getBufferFormat()
Graphics.BufferFormat
instanceboolean supportsExtension(java.lang.String extension)
extension
- the extension name
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |