public class FrameBuffer extends GLFrameBuffer<Texture>
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 GLFrameBuffer.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
GLFrameBuffer.FloatFrameBufferBuilder, GLFrameBuffer.FrameBufferBuilder, GLFrameBuffer.FrameBufferCubemapBuilder, GLFrameBuffer.FrameBufferRenderBufferAttachmentSpec, GLFrameBuffer.FrameBufferTextureAttachmentSpec, GLFrameBuffer.GLFrameBufferBuilder<U extends GLFrameBuffer<? extends GLTexture>>
bufferBuilder, buffers, defaultFramebufferHandle, defaultFramebufferHandleInitialized, depthbufferHandle, depthStencilPackedBufferHandle, framebufferHandle, GL_DEPTH24_STENCIL8_OES, hasDepthStencilPackedBuffer, isMRT, stencilbufferHandle, textureAttachments
Modifier | Constructor and Description |
---|---|
protected |
FrameBuffer(GLFrameBuffer.GLFrameBufferBuilder<? extends GLFrameBuffer<Texture>> bufferBuilder)
Creates a GLFrameBuffer from the specifications provided by bufferBuilder
|
|
FrameBuffer(Pixmap.Format format,
int width,
int height,
boolean hasDepth)
Creates a new FrameBuffer having the given dimensions and potentially a depth buffer attached.
|
|
FrameBuffer(Pixmap.Format format,
int width,
int height,
boolean hasDepth,
boolean hasStencil)
Creates a new FrameBuffer having the given dimensions and potentially a depth and a stencil buffer attached.
|
Modifier and Type | Method and Description |
---|---|
protected void |
attachFrameBufferColorTexture(Texture texture)
Override this method in a derived class to attach the backing texture to the GL framebuffer object.
|
protected Texture |
createTexture(GLFrameBuffer.FrameBufferTextureAttachmentSpec attachmentSpec)
Override this method in a derived class to set up the backing texture as you like.
|
protected void |
disposeColorTexture(Texture colorTexture)
Override this method in a derived class to dispose the backing texture as you like.
|
static void |
unbind()
|
begin, bind, build, clearAllFrameBuffers, dispose, end, end, getColorBufferTexture, getDepthBufferHandle, getDepthStencilPackedBuffer, getFramebufferHandle, getHeight, getManagedStatus, getManagedStatus, getStencilBufferHandle, getTextureAttachments, getWidth, invalidateAllFrameBuffers, setFrameBufferViewport
protected FrameBuffer(GLFrameBuffer.GLFrameBufferBuilder<? extends GLFrameBuffer<Texture>> bufferBuilder)
bufferBuilder
- public FrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth)
public FrameBuffer(Pixmap.Format format, int width, int height, boolean hasDepth, boolean hasStencil)
format
- the format of the color buffer; according to the OpenGL ES 2.0 spec, only RGB565, RGBA4444 and RGB5_A1 are
color-renderablewidth
- the width of the framebuffer in pixelsheight
- the height of the framebuffer in pixelshasDepth
- whether to attach a depth bufferGdxRuntimeException
- in case the FrameBuffer could not be createdprotected Texture createTexture(GLFrameBuffer.FrameBufferTextureAttachmentSpec attachmentSpec)
GLFrameBuffer
createTexture
in class GLFrameBuffer<Texture>
protected void disposeColorTexture(Texture colorTexture)
GLFrameBuffer
disposeColorTexture
in class GLFrameBuffer<Texture>
protected void attachFrameBufferColorTexture(Texture texture)
GLFrameBuffer
attachFrameBufferColorTexture
in class GLFrameBuffer<Texture>
public static void unbind()