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 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
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| public static class | |
| public static class | |
| protected static class | |
| protected static class | |
| public abstract static class |
| Modifier and Type | Field and Description |
|---|---|
| protected GLFrameBuffer. | |
| protected static final Map | buffers
the frame buffers |
| protected final IntArray | colorBufferHandles
the colorbuffer render object handles |
| private IntBuffer | |
| protected static int | defaultFramebufferHandle
the default framebuffer handle, a.k.a screen. |
| protected static boolean | defaultFramebufferHandleInitialized
true if we have polled for the default handle already. |
| protected int | depthbufferHandle
the depthbuffer render object handle |
| protected int | depthStencilPackedBufferHandle
the depth stencil packed render buffer object handle |
| private IntBuffer | |
| protected int | framebufferHandle
the framebuffer handle |
| protected static final int | |
| protected boolean | hasDepthStencilPackedBuffer
if has depth stencil packed buffer |
| protected boolean | isMRT
if multiple texture attachments are present |
| protected int | stencilbufferHandle
the stencilbuffer render object handle |
| protected Array | textureAttachments
the color buffer texture |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| protected | GLFrameBuffer(GLFrameBuffer.
Creates a GLFrameBuffer from the specifications provided by bufferBuilder |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| protected abstract void | attachFrameBufferColorTexture(T texture)
Override this method in a derived class to attach the backing texture to the GL framebuffer object. |
| public void | |
| public void | |
| protected void | |
| private void | |
| public static void | |
| protected abstract T | createTexture(GLFrameBuffer.
Override this method in a derived class to set up the backing texture as you like. |
| public void | dispose()
Implements com. Releases all resources associated with the FrameBuffer. |
| protected abstract void | disposeColorTexture(T colorTexture)
Override this method in a derived class to dispose the backing texture as you like. |
| public void | |
| public void | end(int
the x-axis position of the viewport in pixels x, int the y-asis position of the viewport in pixels y, int the width of the viewport in pixels width, int the height of the viewport in pixels height)Unbinds the framebuffer and sets viewport sizes, all drawing will be performed to the normal framebuffer from here on. |
| public int | getColorBufferHandle(int
index of the color buffer as added to the frame buffer builder. n)Returns: The OpenGL handle of a color buffer (see |
| public T | |
| public int | getDepthBufferHandle()
Returns: The OpenGL handle of the (optional) depth buffer (see |
| protected int | getDepthStencilPackedBuffer()
Returns: The OpenGL handle of the packed depth & stencil buffer (GL_DEPTH24_STENCIL8_OES) or 0 if not used. |
| public int | |
| public int | |
| public static StringBuilder | |
| public static String | |
| public int | getStencilBufferHandle()
Returns: The OpenGL handle of the (optional) stencil buffer (see |
| public Array | |
| public int | |
| public static void | |
| protected void | |
| public void | transfer(GLFrameBuffer<T>
the destination of the copy. destination)Transfer pixels from this frame buffer to the destination frame buffer. |
| public void | transfer(GLFrameBuffer<T>
the destination of the copy (should be same size as this frame buffer). destination, int combination of GL20.GL_COLOR_BUFFER_BIT, GL20.GL_STENCIL_BUFFER_BIT, and GL20.GL_DEPTH_BUFFER_BIT. When
GL20.GL_COLOR_BUFFER_BIT is present, every color buffers will be copied to each corresponding color texture
buffers in the destination framebuffer. copyBits)Transfer pixels from this frame buffer to the destination frame buffer. |
| public static void | unbind()
Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on. |
| bufferBuilder | back to summary |
|---|---|
| protected GLFrameBuffer. | |
| buffers | back to summary |
|---|---|
| protected static final Map<Application, Array<GLFrameBuffer<T extends GLTexture>>> buffers the frame buffers | |
| colorBufferHandles | back to summary |
|---|---|
| protected final IntArray colorBufferHandles the colorbuffer render object handles | |
| defaultDrawBuffers | back to summary |
|---|---|
| private IntBuffer defaultDrawBuffers | |
| defaultFramebufferHandle | back to summary |
|---|---|
| protected static int defaultFramebufferHandle the default framebuffer handle, a.k.a screen. | |
| defaultFramebufferHandleInitialized | back to summary |
|---|---|
| protected static boolean defaultFramebufferHandleInitialized true if we have polled for the default handle already. | |
| depthbufferHandle | back to summary |
|---|---|
| protected int depthbufferHandle the depthbuffer render object handle | |
| depthStencilPackedBufferHandle | back to summary |
|---|---|
| protected int depthStencilPackedBufferHandle the depth stencil packed render buffer object handle | |
| drawBuffersForTransfer | back to summary |
|---|---|
| private IntBuffer drawBuffersForTransfer | |
| framebufferHandle | back to summary |
|---|---|
| protected int framebufferHandle the framebuffer handle | |
| GL_DEPTH24_STENCIL8_OES | back to summary |
|---|---|
| protected static final int GL_DEPTH24_STENCIL8_OES | |
| hasDepthStencilPackedBuffer | back to summary |
|---|---|
| protected boolean hasDepthStencilPackedBuffer if has depth stencil packed buffer | |
| isMRT | back to summary |
|---|---|
| protected boolean isMRT if multiple texture attachments are present | |
| stencilbufferHandle | back to summary |
|---|---|
| protected int stencilbufferHandle the stencilbuffer render object handle | |
| textureAttachments | back to summary |
|---|---|
| protected Array<T> textureAttachments the color buffer texture | |
| GLFrameBuffer | back to summary |
|---|---|
| pack-priv GLFrameBuffer() | |
| GLFrameBuffer | back to summary |
|---|---|
| protected GLFrameBuffer(GLFrameBuffer. Creates a GLFrameBuffer from the specifications provided by bufferBuilder | |
| addManagedFrameBuffer | back to summary |
|---|---|
| private static void addManagedFrameBuffer(Application app, GLFrameBuffer<T extends GLTexture> frameBuffer) | |
| attachFrameBufferColorTexture | back to summary |
|---|---|
| protected abstract void attachFrameBufferColorTexture(T texture) Override this method in a derived class to attach the backing texture to the GL framebuffer object. | |
| begin | back to summary |
|---|---|
| public void begin() Binds the frame buffer and sets the viewport accordingly, so everything gets drawn to it. | |
| bind | back to summary |
|---|---|
| public void bind() Makes the frame buffer current so everything gets drawn to it. | |
| build | back to summary |
|---|---|
| protected void build() | |
| checkValidBuilder | back to summary |
|---|---|
| private void checkValidBuilder() | |
| clearAllFrameBuffers | back to summary |
|---|---|
| public static void clearAllFrameBuffers(Application app) | |
| createTexture | back to summary |
|---|---|
| protected abstract T createTexture(GLFrameBuffer. Override this method in a derived class to set up the backing texture as you like. | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Releases all resources associated with the FrameBuffer.
| |
| disposeColorTexture | back to summary |
|---|---|
| protected abstract void disposeColorTexture(T colorTexture) Override this method in a derived class to dispose the backing texture as you like. | |
| end | back to summary |
|---|---|
| public void end() Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on. | |
| end | back to summary |
|---|---|
| public 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.
| |
| getColorBufferHandle | back to summary |
|---|---|
public int getColorBufferHandle(int n)
| |
| getColorBufferTexture | back to summary |
|---|---|
| public T getColorBufferTexture() Convenience method to return the first Texture attachment present in the fbo | |
| getDepthBufferHandle | back to summary |
|---|---|
public int getDepthBufferHandle()
| |
| getDepthStencilPackedBuffer | back to summary |
|---|---|
protected int getDepthStencilPackedBuffer()
| |
| getFramebufferHandle | back to summary |
|---|---|
public int getFramebufferHandle()
| |
| getHeight | back to summary |
|---|---|
public int getHeight()
| |
| getManagedStatus | back to summary |
|---|---|
| public static StringBuilder getManagedStatus(final StringBuilder builder) | |
| getManagedStatus | back to summary |
|---|---|
| public static String getManagedStatus() | |
| getStencilBufferHandle | back to summary |
|---|---|
public int getStencilBufferHandle()
| |
| getTextureAttachments | back to summary |
|---|---|
| public Array Return the Texture attachments attached to the fbo | |
| getWidth | back to summary |
|---|---|
public int getWidth()
| |
| invalidateAllFrameBuffers | back to summary |
|---|---|
| public static void invalidateAllFrameBuffers(Application app) Invalidates all frame buffers. This can be used when the OpenGL context is lost to rebuild all managed frame buffers. This assumes that the texture attached to this buffer has already been rebuild! Use with care. | |
| setFrameBufferViewport | back to summary |
|---|---|
| protected void setFrameBufferViewport() Sets viewport to the dimensions of framebuffer. Called by | |
| transfer | back to summary |
|---|---|
| public void transfer(GLFrameBuffer<T> destination) Transfer pixels from this frame buffer to the destination frame buffer. Usually used when using multisample, it resolves samples from this multisample FBO to a non-multisample as destination in order to be used as textures. This is a convenient method that automatically choose which of stencil, depth, and colors buffers attachment to be copied.
| |
| transfer | back to summary |
|---|---|
| public void transfer(GLFrameBuffer<T> destination, int copyBits) Transfer pixels from this frame buffer to the destination frame buffer. Usually used when using multisample, it resolves samples from this multisample FBO to a non-multisample as destination in order to be used as textures.
| |
| unbind | back to summary |
|---|---|
| public static void unbind() Unbinds the framebuffer, all drawing will be performed to the normal framebuffer from here on. | |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FloatFrameBuffer | build()
Implements abstract com.
|
| FloatFrameBufferBuilder | back to summary |
|---|---|
| public FloatFrameBufferBuilder(int width, int height) | |
| FloatFrameBufferBuilder | back to summary |
|---|---|
| public FloatFrameBufferBuilder(int width, int height, int samples) | |
| build | back to summary |
|---|---|
| public FloatFrameBuffer build() Implements abstract com.
| |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FrameBuffer | build()
Implements abstract com.
|
| FrameBufferBuilder | back to summary |
|---|---|
| public FrameBufferBuilder(int width, int height) | |
| FrameBufferBuilder | back to summary |
|---|---|
| public FrameBufferBuilder(int width, int height, int samples) | |
| build | back to summary |
|---|---|
| public FrameBuffer build() Implements abstract com.
| |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public FrameBufferCubemap | build()
Implements abstract com.
|
| FrameBufferCubemapBuilder | back to summary |
|---|---|
| public FrameBufferCubemapBuilder(int width, int height) | |
| FrameBufferCubemapBuilder | back to summary |
|---|---|
| public FrameBufferCubemapBuilder(int width, int height, int samples) | |
| build | back to summary |
|---|---|
| public FrameBufferCubemap build() Implements abstract com.
| |
| Modifier and Type | Field and Description |
|---|---|
| public int |
| Access | Constructor and Description |
|---|---|
| public |
| internalFormat | back to summary |
|---|---|
| public int internalFormat | |
| FrameBufferRenderBufferAttachmentSpec | back to summary |
|---|---|
| public FrameBufferRenderBufferAttachmentSpec(int internalFormat) | |
| Modifier and Type | Field and Description |
|---|---|
| public int | |
| public int | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| format | back to summary |
|---|---|
| public int format | |
| internalFormat | back to summary |
|---|---|
| public int internalFormat | |
| isDepth | back to summary |
|---|---|
| public boolean isDepth | |
| isFloat | back to summary |
|---|---|
| public boolean isFloat | |
| isGpuOnly | back to summary |
|---|---|
| public boolean isGpuOnly | |
| isStencil | back to summary |
|---|---|
| public boolean isStencil | |
| type | back to summary |
|---|---|
| public int type | |
| FrameBufferTextureAttachmentSpec | back to summary |
|---|---|
| public FrameBufferTextureAttachmentSpec(int internalformat, int format, int type) | |
| isColorTexture | back to summary |
|---|---|
| public boolean isColorTexture() | |
| Modifier and Type | Field and Description |
|---|---|
| public Array | |
| public GLFrameBuffer. | |
| public boolean | |
| public boolean | |
| public boolean | |
| public int | |
| public GLFrameBuffer. | |
| public int | |
| public GLFrameBuffer. | |
| public Array | |
| public int |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public GLFrameBuffer. | |
| public abstract U |
| colorRenderBufferSpecs | back to summary |
|---|---|
| public Array<GLFrameBuffer. | |
| depthRenderBufferSpec | back to summary |
|---|---|
| public GLFrameBuffer. | |
| hasDepthRenderBuffer | back to summary |
|---|---|
| public boolean hasDepthRenderBuffer | |
| hasPackedStencilDepthRenderBuffer | back to summary |
|---|---|
| public boolean hasPackedStencilDepthRenderBuffer | |
| hasStencilRenderBuffer | back to summary |
|---|---|
| public boolean hasStencilRenderBuffer | |
| height | back to summary |
|---|---|
| public int height | |
| packedStencilDepthRenderBufferSpec | back to summary |
|---|---|
| public GLFrameBuffer. | |
| samples | back to summary |
|---|---|
| public int samples | |
| stencilRenderBufferSpec | back to summary |
|---|---|
| public GLFrameBuffer. | |
| textureAttachmentSpecs | back to summary |
|---|---|
| public Array<GLFrameBuffer. | |
| width | back to summary |
|---|---|
| public int width | |
| GLFrameBufferBuilder | back to summary |
|---|---|
| public GLFrameBufferBuilder(int width, int height) | |
| GLFrameBufferBuilder | back to summary |
|---|---|
| public GLFrameBufferBuilder(int width, int height, int samples) | |
| addBasicColorTextureAttachment | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addBasicDepthRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addBasicStencilDepthPackedRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addBasicStencilRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addColorRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addColorTextureAttachment | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addDepthRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addDepthTextureAttachment | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addFloatAttachment | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addStencilDepthPackedRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addStencilRenderBuffer | back to summary |
|---|---|
| public GLFrameBuffer. | |
| addStencilTextureAttachment | back to summary |
|---|---|
| public GLFrameBuffer. | |
| build | back to summary |
|---|---|
| public abstract U build() | |