GLFrameBufferRenderer.Builder
public final class GLFrameBufferRenderer.Builder
Builder used to create a GLFrameBufferRenderer with various configurations
Summary
Public constructors |
|---|
Builder(Create a new |
Public methods |
|
|---|---|
final @NonNull GLFrameBufferRenderer |
build()Create the |
final @NonNull GLFrameBufferRenderer.Builder |
setBufferFormat(int format)Specify the buffer format of the underlying buffers being rendered into by the created |
final @NonNull GLFrameBufferRenderer.Builder |
setGLRenderer(GLRenderer glRenderer)Configure the |
final @NonNull GLFrameBufferRenderer.Builder |
setMaxBuffers(@IntRange(from = 1, to = 64) int numBuffers)Specify the maximum number of buffers used within the swap chain of the |
final @NonNull GLFrameBufferRenderer.Builder |
setSyncStrategy(@NonNull SyncStrategy syncStrategy)Specify the |
final @NonNull GLFrameBufferRenderer.Builder |
setUsageFlags(long usageFlags)Specify the usage flags to be configured on the underlying |
Public constructors
Builder
public Builder(
@NonNull SurfaceView surfaceView,
@NonNull GLFrameBufferRenderer.Callback callback
)
Create a new GLFrameBufferRenderer.Builder with the provided SurfaceView to be the parent of the SurfaceControlCompat that is presented on screen.
| Parameters | |
|---|---|
@NonNull SurfaceView surfaceView |
SurfaceView to be the parent of the |
@NonNull GLFrameBufferRenderer.Callback callback |
Callback used to render content within the corresponding buffers as well as optionally configuring |
Public methods
build
public final @NonNull GLFrameBufferRenderer build()
Create the GLFrameBufferRenderer with the specified parameters on this Builder instance
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer |
The newly created |
setBufferFormat
public final @NonNull GLFrameBufferRenderer.Builder setBufferFormat(int format)
Specify the buffer format of the underlying buffers being rendered into by the created GLFrameBufferRenderer. The set of valid formats is implementation-specific and may depend on additional EGL extensions. The particular valid combinations for a given Android version and implementation should be documented by that version.
HardwareBuffer.RGBA_8888 and HardwareBuffer.RGBX_8888 are guaranteed to be supported. However, consumers are recommended to query the desired HardwareBuffer configuration using HardwareBuffer.isSupported.
See: khronos.org/registry/EGL/extensions/ANDROID/EGL_ANDROID_get_native_client_buffer.txt
| Parameters | |
|---|---|
int format |
Pixel format of the buffers to be rendered into. The default is RGBA_8888. |
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer.Builder |
The builder instance |
setGLRenderer
public final @NonNull GLFrameBufferRenderer.Builder setGLRenderer(GLRenderer glRenderer)
Configure the GLRenderer instance to be used by the GLFrameBufferRenderer. By default this parameter is null indicating that the GLFrameBufferRenderer will create and manage its own GLRenderer. This is useful to share the same OpenGL resources and thread across multiple GLFrameBufferRenderer instances.
| Parameters | |
|---|---|
GLRenderer glRenderer |
The |
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer.Builder |
The builder instance |
setMaxBuffers
public final @NonNull GLFrameBufferRenderer.Builder setMaxBuffers(@IntRange(from = 1, to = 64) int numBuffers)
Specify the maximum number of buffers used within the swap chain of the GLFrameBufferRenderer. If 1 is specified, then the created GLFrameBufferRenderer is running in "single buffer mode". In this case consumption of the buffer content would need to be coordinated with the SyncFenceCompat instance specified by the corresponding SyncStrategy algorithm
| Parameters | |
|---|---|
@IntRange(from = 1, to = 64) int numBuffers |
The number of buffers within the swap chain to be consumed by the created |
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer.Builder |
The builder instance |
| See also | |
|---|---|
setSyncStrategy |
. |
setSyncStrategy
public final @NonNull GLFrameBufferRenderer.Builder setSyncStrategy(@NonNull SyncStrategy syncStrategy)
Specify 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.
| Parameters | |
|---|---|
@NonNull SyncStrategy syncStrategy |
|
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer.Builder |
The builder instance |
setUsageFlags
public final @NonNull GLFrameBufferRenderer.Builder setUsageFlags(long usageFlags)
Specify the usage flags to be configured on the underlying HardwareBuffer instances created by the GLFrameBufferRenderer.
| Parameters | |
|---|---|
long usageFlags |
Usage flags to be configured on the created |
| Returns | |
|---|---|
@NonNull GLFrameBufferRenderer.Builder |
The builder instance |