public class FrameBuffer extends java.lang.Object implements Disposable
Encapsulates OpenGL ES 2.0 frame buffer objects. This is a simple helper class which should cover most FBO uses. It will
automatically create a texture for the color attachment and a renderbuffer for the depth buffer. You can get a hold of the
texture by getColorBufferTexture(). This class will only work with OpenGL ES 2.0.
FrameBuffers are managed. In case of an OpenGL context loss, which only happens on Android when a user switches to another application or receives an incoming call, the framebuffer will be automatically recreated.
A FrameBuffer must be disposed if it is no longer needed
| Modifier and Type | Field and Description |
|---|---|
protected Texture |
colorTexture
the color buffer texture
|
protected Pixmap.Format |
format
format
|
protected boolean |
hasDepth
depth
|
protected int |
height
height
|
protected int |
width
width
|
| Constructor and Description |
|---|
FrameBuffer(Pixmap.Format format,
int width,
int height,
boolean hasDepth)
Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached.
|
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Makes the frame buffer current so everything gets drawn to it.
|
static void |
clearAllFrameBuffers(Application app) |
void |
dispose()
Releases all resources associated with the FrameBuffer.
|
void |
end()
Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on.
|
Texture |
getColorBufferTexture() |
int |
getHeight() |
static java.lang.String |
getManagedStatus() |
int |
getWidth() |
static void |
invalidateAllFrameBuffers(Application app)
Invalidates all frame buffers.
|
protected void |
setupTexture()
Override this method in a derived class to set up the backing texture as you like.
|
protected Texture colorTexture
protected final int width
protected final int height
protected final boolean hasDepth
protected final Pixmap.Format format
public FrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth)
format - the format of the color bufferwidth - the width of the framebuffer in pixelsheight - the height of the framebuffer in pixelshasDepth - whether to attach a depth bufferGdxRuntimeException - in case the FraeBuffer could not be createdprotected void setupTexture()
public void dispose()
dispose in interface Disposablepublic void begin()
public void end()
public static void invalidateAllFrameBuffers(Application app)
public static void clearAllFrameBuffers(Application app)
public static java.lang.String getManagedStatus()
public Texture getColorBufferTexture()
public int getHeight()
public int getWidth()