GLFrameBufferRenderer
@RequiresApi(value = 29)
class GLFrameBufferRenderer
Class responsible for supporting rendering to frame buffer objects that are backed by HardwareBuffer instances. This provides for more flexibility in OpenGL rendering as it supports configuration of the number of buffers within the underlying swap chain, pixel format of the buffers as well as fine grained control over synchronization of buffer content.
Summary
Nested types |
|---|
|
Builder used to create a |
interface GLFrameBufferRenderer.Callback
|
Public functions |
|
|---|---|
Unit |
Queue a |
Boolean |
isValid()Determines whether or not the |
Unit |
Release resources associated with the |
Unit |
render()Render content to a buffer and present the result to the display. |
Public properties |
|
|---|---|
Int |
Returns the |
GLRenderer |
Returns the |
Int |
Returns the number of buffers within the swap chain used for rendering with this |
SyncStrategy |
Returns the |
Long |
Returns the current usage flag hints of the buffers that are being rendered into by this |
Public functions
execute
fun execute(runnable: Runnable): Unit
Queue a Runnable to be executed on the GL rendering thread. Note it is important this Runnable does not block otherwise it can stall the GL thread.
| Parameters | |
|---|---|
runnable: Runnable |
to be executed |
isValid
fun isValid(): Boolean
Determines whether or not the GLFrameBufferRenderer is in a valid state. That is the release method has not been called. If this returns false, then subsequent calls to render, and release are ignored
| Returns | |
|---|---|
Boolean |
|
release
fun release(cancelPending: Boolean, onReleaseCallback: (() -> Unit)? = null): Unit
Release resources associated with the GLFrameBufferRenderer. After this method is invoked, the GLFrameBufferRenderer is in an invalid state and can no longer handle rendering content.
| Parameters | |
|---|---|
cancelPending: Boolean |
Flag to indicate that in process requests should be completed before the |
onReleaseCallback: (() -> Unit)? = null |
Optional callback to be invoked on the underlying OpenGL thread when releasing resources has been completed |
render
fun render(): Unit
Render content to a buffer and present the result to the display.
If this GLFrameBufferRenderer has been released, that is isValid returns false, this call is ignored.
Public properties
bufferFormat
val bufferFormat: Int
Returns the HardwareBufferFormat of the buffers that are being rendered into by this GLFrameBufferRenderer
glRenderer
val glRenderer: GLRenderer
Returns the GLRenderer used for issuing requests to render into the underlying buffers with OpenGL.
maxBuffers
val maxBuffers: Int
Returns the number of buffers within the swap chain used for rendering with this GLFrameBufferRenderer
syncStrategy
val syncStrategy: SyncStrategy
Returns the SyncStrategy used for determining when to create SyncFenceCompat objects in order to handle synchronization. The SyncFenceCompat instance created according to the algorithm specified in the provided SyncStrategy will be passed to the corresponding SurfaceControlCompat.Transaction.setBuffer call in order to ensure the underlying buffer is not presented by the display until the fence signals.
usageFlags
val usageFlags: Long
Returns the current usage flag hints of the buffers that are being rendered into by this GLFrameBufferRenderer