docs/android/dokka/filament-android/com.google.android.filament/-renderer/render.md
//filament-android/com.google.android.filament/Renderer/render
[main]
open fun render(view: View)
Renders a View into this Renderer's window.
This is filament's main rendering method, most of the CPU-side heavy lifting is performed here. The purpose of the render() function is to generate render commands which are asynchronously executed by the Engine's render thread.
render() generates commands for each of the following stages:
A typical render loop looks like this:
void renderLoop(Renderer renderer, SwapChain swapChain) {
do {
// typically we wait for VSYNC and user input events
if (renderer.beginFrame(swapChain)) {
renderer.render(mView);
renderer.endFrame();
}
} while (!quit());
}
render() must be called afterbeginFrame and beforeendFrame.render() must be called from the Engine's main thread (or external synchronization must be provided). In particular, calls to render() on different Renderer instances must be synchronized.render() performs potentially heavy computations and cannot be multi-threaded. However, internally, it is highly multi-threaded to both improve performance and mitigate the call's latency.render() is typically called once per frame (but not necessarily).main
| view | the View to render |
| beginFrame |
| endFrame |
| View |
| Error | if the backend thread encountered an unrecoverable error, or if called again after a backend exception was already thrown. |