WVR_GetTexture

WVR_EXPORT WVR_TextureParams_t WVR_GetTexture(WVR_TextureQueueHandle_t handle, int32_t index)

Get texture of given index in the given texture queue.

Use the index returned from WVR_GetAvailableTextureIndex. The available index can specify the available texture in texture queue maintained in runtime.

Return
The struct WVR_TextureParams_t. aggregate the name of texture as a member inside the struct.
Parameters
  • handle -

    The texture queue handle returned by WVR_ObtainTextureQueue

  • index -

    The index of the texture in the queue.

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);

WVR_SubmitError e;
e = WVR_SubmitFrame(WVR_Eye_Left, &leftEyeTexture);

// Right eye
e = WVR_SubmitFrame(WVR_Eye_Right, &rightEyeTexture);