Table of Contents

Class SurfaceTextureCaptureSession

This is an experimental capture session type that uses a native OpenGL texture to capture images for better performance.

public class SurfaceTextureCaptureSession : ContinuousCaptureSession
Inheritance
object
SurfaceTextureCaptureSession
Derived
Inherited Members

Remarks

The results of this capture session may be more noisy compared to ContinuousCaptureSession. Requires OpenGL ES 3.0 or higher as the project's Graphics API. Works with single and multi-threaded rendering.

Fields

CreateGlTextureEvent

Native event to create the native texture.

protected const int CreateGlTextureEvent = 1

Field Value

int

DestroyGlTextureEvent

Native event to destroy the native texture.

protected const int DestroyGlTextureEvent = 2

Field Value

int

UpdateSurfaceTextureEvent

Native event to update the native texture and convert it to the Unity texture.

protected const int UpdateSurfaceTextureEvent = 3

Field Value

int

_commandBuffer

The command buffer to issue native events.

protected CommandBuffer _commandBuffer

Field Value

CommandBuffer

s_nativeTextureCallbacks

Queue for native event callbacks.

protected static readonly ConcurrentQueue<Action> s_nativeTextureCallbacks

Field Value

ConcurrentQueue<Action>

Properties

Resolution

The resolution of this capture session.

public Resolution Resolution { get; }

Property Value

Resolution

Texture

The texture that will be updated with the camera feed.

public Texture2D Texture { get; }

Property Value

Texture2D

Methods

Awake()

protected void Awake()

CallNativeEvent<T>(T, int, Action)

Sends an event to the native plugin.

protected virtual void CallNativeEvent<T>(T data, int eventId, Action additionalAction = null) where T : struct

Parameters

data T

The data to send.

eventId int

The unique ID of the event.

additionalAction Action

Any additional action to be done after the event is completed.

Type Parameters

T

The type of the data to send.

GetRenderEventFunction()

Gets the pointer to the native rendering function.

protected static extern nint GetRenderEventFunction()

Returns

nint

NativeTextureCallback()

Callback for the native texture events. It will dequeue from s_nativeTextureCallbacks and call it.

protected static void NativeTextureCallback()

OnDestroy()

protected override void OnDestroy()

_destroyNativeTexture(string)

public virtual void _destroyNativeTexture(string textureId)

Parameters

textureId string

_onCaptureCompleted(string)

public virtual void _onCaptureCompleted(string textureId)

Parameters

textureId string