AuWorld is the point where the AR session and the renderer meet. From an application perspective, it is best understood as the scene coordinator: it receives graphics lifecycle events, updates display geometry, and keeps the content synchronized with the current tracking state.
The role of AuWorld
Section titled “The role of AuWorld”The world is mainly responsible for:
- keeping active anchors registered;
- receiving rendering surface lifecycle events;
- forwarding viewport updates;
- performing per-frame scene updates.
Integrating into the rendering loop
Section titled “Integrating into the rendering loop”On Android, a typical integration can be built by hosting a GLSurfaceView inside Compose and forwarding the renderer callbacks to AuWorld:
@Composableactual fun OpenGLSurfacePlaceholder(scene: AuWorld, modifier: Modifier) { AndroidView( modifier = modifier.fillMaxSize(), factory = { context -> GLSurfaceView(context).apply { preserveEGLContextOnPause = true setEGLContextClientVersion(2) setEGLConfigChooser(8, 8, 8, 8, 16, 0) setRenderer(object : GLSurfaceView.Renderer { override fun onSurfaceCreated(gl: GL10?, config: EGLConfig?) { scene.onSurfaceCreated(context) } @RequiresApi(Build.VERSION_CODES.R) override fun onSurfaceChanged(gl: GL10?, w: Int, h: Int) { scene.onSurfaceChanged(context.display.rotation, w, h) } override fun onDrawFrame(gl: GL10?) { scene.onDrawFrame() } }) renderMode = GLSurfaceView.RENDERMODE_CONTINUOUSLY setWillNotDraw(false) } } )}This example is Android-specific, but the integration principle is the same on other platforms: surface creation, viewport changes, and frame rendering must be forwarded to the world.
The order matters:
- onSurfaceCreated prepares the session and native rendering resources;
- onSurfaceChanged updates viewport size and rotation;
- onDrawFrame synchronizes tracking, anchors, and actual rendering.
Viewport handling
Section titled “Viewport handling”Changes in orientation or size do not require recreating the world. The application only needs to notify the new state through onSurfaceChanged. AuWorld will apply the updated display geometry on the next useful frame.
This keeps the application code clean: the view only forwards graphics events, while the world maintains consistency between the AR session and the native renderer.
HDR lighting
Section titled “HDR lighting”If the session supports HDR, the world can receive a DFG texture through setSpecularDfgTexture. In practical terms, this texture enables better rendering of specular and PBR materials.
setSpecularDfgTexture should be called by passing the actual DFG texture object to the world. In other words, the application is responsible for preparing an AuTexture that contains the DFG lookup data and then supplying that texture to the scene.
The main rule to remember is:
- call setSpecularDfgTexture immediately after onSurfaceCreated when the application sets up an HDR pipeline.
As a matter of good practice, the DFG asset should normally be embedded as an application resource. It is generally a stable support asset for the rendering pipeline, not scene content that changes at runtime. Treating it as an embedded resource keeps initialization predictable and avoids unnecessary runtime dependency on external content sources.
Naturally, this file only needs to be added to the application when HDR is actually enabled. If the project does not use the HDR path, there is no reason to package or load the DFG resource.
Good practices
Section titled “Good practices”- Keep a single AuWorld instance for each active AR scene.
- Do not embed business logic inside the renderer: the renderer should only forward events and coordinate the scene.
- Use the world as the stable root and delegate content variability to anchors and groups.