SwapChain

class SwapChain(nativeHandle: NativePointer, window: NativePointer = NullPointer)

A SwapChain represents an Operating System's native renderable surface.

Typically, it's a native window or a view. A SwapChain is initialized from a native object, which must be of the proper type for each platform Filament is running on:

PlatformNative Type
AndroidANativeWindow*
macOS - OpenGLNSView*
macOS - MetalCAMetalLayer*
iOS - OpenGLCAEAGLLayer*
iOS - MetalCAMetalLayer*
X11Window
WindowsHWND

See also

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer, window: NativePointer = NullPointer)

Types

Link copied to clipboard

Strategy for applying a frame rate change that is not seamless.

Link copied to clipboard
object Companion
Link copied to clipboard

Frame rate compatibility strategy for setFrameRate.

Properties

Link copied to clipboard
@PlatformGap(platforms = [FilamentPlatform.WEB], behavior = "returns FALSE — display frame rate switching is not supported on web; pacing is browser-managed.")
val isFrameRateChangeSupported: Engine.FeatureState

Returns whether this SwapChain supports the setFrameRate API.

Link copied to clipboard

Checks if a frame scheduled callback is currently set on this SwapChain.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Gets the native window/surface associated with this SwapChain.

Functions

Link copied to clipboard
@PlatformGap(platforms = [FilamentPlatform.WEB], behavior = "never fires — OpenGLDriver (the WebGL backend) implements the frame-completed callback as a no-op.")
fun setFrameCompletedCallback(callback: () -> Unit? = null)

Sets a callback to be invoked when a frame's rendering has completed on the GPU.

Link copied to clipboard
fun setFrameRate(frameRate: Float)

Sets the intended frame rate for this SwapChain.

Link copied to clipboard
fun setFrameScheduledCallback(callback: () -> Unit? = null)

Sets a callback to be invoked when a frame is scheduled for presentation.