FrameBufferRenderer.RenderCallback


public interface FrameBufferRenderer.RenderCallback


Callbacks invoked to render content leveraging a FrameBufferRenderer

Summary

Public methods

abstract @NonNull FrameBuffer

Obtain a FrameBuffer to render content into.

abstract void
onDraw(@NonNull EGLManager eglManager)

Draw contents into the HardwareBuffer.

abstract void
onDrawComplete(
    @NonNull FrameBuffer frameBuffer,
    SyncFenceCompat syncFenceCompat
)

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

Public methods

obtainFrameBuffer

Added in 1.0.2
abstract @NonNull FrameBuffer obtainFrameBuffer(@NonNull EGLSpec egl)

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
@NonNull EGLSpec egl

EGLSpec that is utilized within creation of the FrameBuffer object

onDraw

Added in 1.0.2
abstract void onDraw(@NonNull EGLManager eglManager)

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
abstract void onDrawComplete(
    @NonNull FrameBuffer frameBuffer,
    SyncFenceCompat syncFenceCompat
)

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

Parameters
@NonNull 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.