-
public class SwapChainA
SwapChainrepresents an Operating System's native renderable surface.Typically it's a native window or a view. Because a
SwapChainis initialized from a native object, it is given to filament as anObject, which must be of the proper type for each platform filament is running on.SwapChain swapChain = engine.createSwapChain(nativeWindow);The
ExamplesAndroidnativeWindowparameter 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() }
-
-
Field Summary
Fields Modifier and Type Field Description public final static longCONFIG_DEFAULTpublic final static longCONFIG_TRANSPARENTpublic final static longCONFIG_READABLEpublic final static longCONFIG_ENABLE_XCBpublic final static longCONFIG_SRGB_COLORSPACE
-
Method Summary
Modifier and Type Method Description static booleanisSRGBSwapChainSupported(@NonNull() Engine engine)Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.The default implementation returns false. ObjectgetNativeWindow()voidsetFrameCompletedCallback(@NonNull() Object handler, @NonNull() Runnable callback)FrameCompletedCallback is a callback function that notifies an application when a frame'scontents have completed rendering on the GPU. longgetNativeObject()-
-
Method Detail
-
isSRGBSwapChainSupported
static boolean isSRGBSwapChainSupported(@NonNull() Engine engine)
Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.The default implementation returns false.
- Parameters:
engine- A reference to the filament Engine
-
getNativeWindow
Object getNativeWindow()
-
setFrameCompletedCallback
void setFrameCompletedCallback(@NonNull() Object handler, @NonNull() Runnable callback)
FrameCompletedCallback is a callback function that notifies an application when a frame'scontents have completed rendering on the GPU.
Use setFrameCompletedCallback to set a callback on an individual SwapChain. Each time a framecompletes GPU rendering, the callback will be called.
The FrameCompletedCallback is guaranteed to be called on the main Filament thread.
Warning: Only Filament's Metal backend supports frame callbacks. Other backends ignore thecallback (which will never be called) and proceed normally.
- Parameters:
handler- A Executor.callback- The Runnable callback to invoke.
-
getNativeObject
long getNativeObject()
-
-
-
-