WVR_GetAvailableTextureIndex

WVR_EXPORT int32_t WVR_GetAvailableTextureIndex(WVR_TextureQueueHandle_t handle)

Get the index of an available texture.

Before drawing, applications should call this function to get the index of an available texture and call WVR_GetTexture to get the real texture ID.

Return
The ID of the texture. -1 means no available texture currently or invalid handle.
Parameters

How to use

Here is an example for the function:

// Must initialize render runtime once before calling all rendering-related API.
WVR_RenderInitParams_t param = {WVR_GraphicsApiType_OpenGL, WVR_RenderConfig_Timewarp_Asynchronous};
WVR_RenderError pError = WVR_RenderInit(&param);
if (pError != WVR_RenderError_None) {
    LOGE("Render init failed - Error[%d]", pError);
}

uint32_t RenderWidth = 0, RenderHeight = 0;

WVR_GetRenderTargetSize(&RenderWidth, &RenderHeight);

//Get the texture queue handler
void* LeftEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, RenderWidth, RenderHeight, 0);
void* RightEyeQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, RenderWidth, RenderHeight, 0);

//Get the available texture index in texture queue.
int32_t IndexLeft = WVR_GetAvailableTextureIndex(LeftEyeQ);
int32_t IndexRight = WVR_GetAvailableTextureIndex(RightEyeQ);

//Specify the texture in texture queue.
WVR_TextureParams_t leftEyeTexture = WVR_GetTexture(LeftEyeQ, IndexLeft);
WVR_TextureParams_t RightEyeTexture = WVR_GetTexture(RightEyeQ, IndexRight);