docs/android/dokka/filament-android/com.google.android.filament/-swap-chain/index.md
//filament-android/com.google.android.filament/SwapChain
open class SwapChain
A SwapChain represents an Operating System's native renderable surface.
Typically it's a native window or a view. Because a SwapChain is initialized from a native object, it is given to filament as an Object, which must be of the proper type for each platform filament is running on.
SwapChain swapChain = engine.createSwapChain(nativeWindow);
The nativeWindow parameter above must be of type:
A Surface can be retrieved from a SurfaceView or SurfaceHolder easily using SurfaceHolder.getSurface() and/or SurfaceView.getHolder().
To use a Textureview as a SwapChain, it is necessary to first get its SurfaceTexture, for instance using SurfaceTextureListener and then create a Surface:
// using a TextureView.SurfaceTextureListener:
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
mSurface = new Surface(surfaceTexture);
// mSurface can now be used with Engine.createSwapChain()
}
| Engine |
| Name | Summary |
|---|---|
| ChangeFrameRateStrategy | [main] |
| enum ChangeFrameRateStrategy | |
| FrameRateCompatibility | [main] |
| enum FrameRateCompatibility |
| Name | Summary |
|---|---|
| getNativeObject | [main] |
| open fun getNativeObject(): Long | |
| getNativeWindow | [main] |
| open fun getNativeWindow(): Any | |
| isFrameRateChangeSupported | [main] |
| open fun isFrameRateChangeSupported(): Boolean | |
| Return whether this SwapChain supports the setFrameRate() API. | |
| isFrameScheduledCallbackSet | [main] |
| open fun isFrameScheduledCallbackSet(): Boolean | |
| Returns whether this SwapChain currently has a FrameScheduledCallback set. | |
| isMSAASwapChainSupported | [main] |
| open fun isMSAASwapChainSupported(engine: Engine, samples: Int): Boolean | |
| Return whether createSwapChain supports the CONFIG_MSAA_*_SAMPLES flag. | |
| isProtectedContentSupported | [main] |
| open fun isProtectedContentSupported(engine: Engine): Boolean | |
| Return whether createSwapChain supports the CONFIG_PROTECTED_CONTENT flag. | |
| isSRGBSwapChainSupported | [main] |
| open fun isSRGBSwapChainSupported(engine: Engine): Boolean | |
| Return whether createSwapChain supports the CONFIG_SRGB_COLORSPACE flag. | |
| setFrameCompletedCallback | [main] |
| open fun setFrameCompletedCallback(handler: Any, callback: Runnable) | |
| FrameCompletedCallback is a callback function that notifies an application when a frame's contents have completed rendering on the GPU. | |
| setFrameRate | [main] |
| open fun setFrameRate(frameRate: Float) | |
| open fun setFrameRate(frameRate: Float, compatibility: SwapChain.FrameRateCompatibility, strategy: SwapChain.ChangeFrameRateStrategy) | |
| Sets the intended frame rate for this SwapChain. | |
| setFrameScheduledCallback | [main] |
| open fun setFrameScheduledCallback(handler: Any, callback: Runnable) | |
| FrameScheduledCallback is a callback function that notifies an application about the status of a frame after Filament has finished its processing. |