FrameBufferRenderer.RenderCallback


interface FrameBufferRenderer.RenderCallback


Callbacks invoked to render content leveraging a FrameBufferRenderer

Summary

Public functions

FrameBuffer

Obtain a FrameBuffer to render content into.

Unit
onDraw(eglManager: EGLManager)

Draw contents into the HardwareBuffer.

Unit
onDrawComplete(
    frameBuffer: FrameBuffer,
    syncFenceCompat: SyncFenceCompat?
)

Callback when onDraw is complete and the contents of the draw are reflected in the corresponding HardwareBuffer.

Public functions

obtainFrameBuffer

Added in 1.0.2
fun obtainFrameBuffer(egl: EGLSpec): FrameBuffer

Obtain a FrameBuffer to render content into. The FrameBuffer obtained here is expected to be managed by the consumer of FrameBufferRenderer. That is implementations of this API are expected to be maintaining a reference to the returned FrameBuffer here and calling FrameBuffer.close where appropriate as the instance will not be released by FrameBufferRenderer.

Parameters
egl: EGLSpec

EGLSpec that is utilized within creation of the FrameBuffer object

onDraw

Added in 1.0.2
fun onDraw(eglManager: EGLManager): Unit

Draw contents into the HardwareBuffer. Before this method is invoked the FrameBuffer instance returned in obtainFrameBuffer is made current

onDrawComplete

Added in 1.0.2
fun onDrawComplete(
    frameBuffer: FrameBuffer,
    syncFenceCompat: SyncFenceCompat?
): Unit

Callback when onDraw is complete and the contents of the draw are reflected in the corresponding HardwareBuffer.

Parameters
frameBuffer: FrameBuffer

FrameBuffer that content is rendered into. The frameBuffer should not be consumed unless the syncFenceCompat is signalled or the fence is null. This is the same FrameBuffer instance returned in obtainFrameBuffer

syncFenceCompat: SyncFenceCompat?

SyncFenceCompat is used to determine when rendering is done in onDraw and reflected within the given frameBuffer.