Skip to main content

XR8.GlTextureRenderer.setForegroundTextureProvider()

XR8.GlTextureRenderer.setForegroundTextureProvider(({ frameStartResult, processGpuResult, processCpuResult }) => {} )

Description

Sets a provider that passes a list of foreground textures to draw. This should be a function that take the same inputs as cameraPipelineModule.onUpdate.

Parameters

setForegroundTextureProvider() takes a function with the following parameters:

ParameterTypeDescription
frameStartResultObjectThe data that was provided at the beginning of a frame.
processGpuResultObjectData returned by all installed modules during onProcessGpu.
processCpuResultObjectData returned by all installed modules during onProcessCpu.

The function should return an array of objects which each contain the following properties:

PropertyTypeDefaultDescription
foregroundTextureWebGLTextureThe foreground texture to draw.
foregroundMaskTextureWebGLTextureAn alpha mask to use on the foregroundTexture. The r channel of the foregroundMaskTexture is used in the alpha blending.
foregroundTextureFlipY [Optional]falseBooleanWhether to flip the foregroundTexture.
foregroundMaskTextureFlipY [Optional]falseBooleanWhether to flip the foregroundMaskTexture.

The foreground textures will be drawn on top of the texture provided by calling XR8.GlTextureRenderer.setTextureProvider(). The foreground textures will be drawn in in the order of the returned array.

Returns

None

Example

XR8.GlTextureRenderer.setForegroundTextureProvider(
({processGpuResult}) => {
// Do some processing...
return [{
foregroundTexture,
foregroundMaskTexture,
foregroundTextureFlipY,
foregroundMaskTextureFlipY
}]
})