public abstract class GLFrameBuffer<T extends GLTexture> extends 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 gltexture for the color attachment and a renderbuffer for the depth buffer. You can get a hold of the
gltexture 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 | Class and Description |
---|---|
static class |
GLFrameBuffer.FloatFrameBufferBuilder |
static class |
GLFrameBuffer.FrameBufferBuilder |
static class |
GLFrameBuffer.FrameBufferCubemapBuilder |
Modifier and Type | Method and Description |
---|---|
void |
begin()
Binds the frame buffer and sets the viewport accordingly, so everything gets drawn to it.
|
void |
bind()
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.
|
void |
end(int x,
int y,
int width,
int height)
Unbinds the framebuffer and sets viewport sizes, all drawing will be performed to the normal framebuffer from here on.
|
T |
getColorBufferTexture()
Convenience method to return the first Texture attachment present in the fbo
|
int |
getDepthBufferHandle() |
int |
getFramebufferHandle() |
int |
getHeight() |
static String |
getManagedStatus() |
static StringBuilder |
getManagedStatus(StringBuilder builder) |
int |
getStencilBufferHandle() |
Array<T> |
getTextureAttachments()
Return the Texture attachments attached to the fbo
|
int |
getWidth() |
static void |
invalidateAllFrameBuffers(Application app)
Invalidates all frame buffers.
|
static void |
unbind()
Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on.
|
public T getColorBufferTexture()
public Array<T> getTextureAttachments()
public void dispose()
dispose
in interface Disposable
public void bind()
public static void unbind()
public void begin()
public void end()
public void end(int x, int y, int width, int height)
x
- the x-axis position of the viewport in pixelsy
- the y-asis position of the viewport in pixelswidth
- the width of the viewport in pixelsheight
- the height of the viewport in pixelspublic int getFramebufferHandle()
GL20.glGenFramebuffer()
)public int getDepthBufferHandle()
GL20.glGenRenderbuffer()
). May return 0 even if depth
buffer enabledpublic int getStencilBufferHandle()
GL20.glGenRenderbuffer()
). May return 0 even if
stencil buffer enabledpublic int getHeight()
public int getWidth()
public static void invalidateAllFrameBuffers(Application app)
public static void clearAllFrameBuffers(Application app)
public static StringBuilder getManagedStatus(StringBuilder builder)
public static String getManagedStatus()
Copyright © 2018. All rights reserved.