WVR_ObtainTextureQueue

WVR_EXPORT WVR_TextureQueueHandle_t WVR_ObtainTextureQueue(WVR_TextureTarget target, WVR_TextureFormat format, WVR_TextureType type, uint32_t width, uint32_t height, int32_t level)

Obtain a new texture queue.

Several texture queue related methods are provided for maintaining textures. Call WVR_ReleaseTextureQueue to release the queue when the queue is no longer used.

Return
The handle of the queue WVR_TextureQueueHandle_t.
Version
API Level 1
Parameters
  • target: Specifies the target texture. For target WVR_TextureTarget_2D_EXTERNAL, WVR_ObtainTextureQueue only create textures without EGLImage objects. Therefore, user are expected to bind EGLImage to textures by glEGLImageTargetTexture2DOES, Android SurfaceTexture etc..
  • format: Specifies the number of color components in the texture. Must be WVR_TextureFormat_RGBA.
  • type: Specifies the data type of the pixel data. The following symbolic values are accepted: WVR_TextureType_UnsignedByte.
  • width: Specifies the width of the texture image. For targets WVR_TextureTarget_2D_DUAL and WVR_TextureTarget_2D_EXT_DUAL, the width should be double large.
  • height: Specifies the height of the texture image.
  • level: Specifies the level-of-detail number.

Struct and enumeration

enum WVR_TextureTarget

Target texture.

Enumerate the specific target texture to generate texture.

Values:

WVR_TextureTarget_2D

WVR_TextureTarget_2D: Correspond to OpenGL target texture GL_TEXTURE_2D

WVR_TextureTarget_2D_ARRAY

WVR_TextureTarget_2D_ARRAY: Correspond to OpenGL target texture GL_TEXTURE_2D_ARRAY

WVR_TextureTarget_2D_EXTERNAL

WVR_TextureTarget_2D_EXTERNAL: Correspond to OpenGL target texture GL_TEXTURE_EXTERNAL_OES

WVR_TextureTarget_2D_DUAL

WVR_TextureTarget_2D_DUAL: Correspond to OpenGL target texture GL_TEXTURE_2D. Both two eyes are rendered in the same texture, and therefore the texture width should be double large.

WVR_TextureTarget_2D_EXT_DUAL

WVR_TextureTarget_2D_EXT_DUAL: Correspond to OpenGL target texture GL_TEXTURE_EXTERNAL_OES. Both two eyes are rendered in the same texture, and therefore the texture width should be double large.

WVR_TextureTarget_VULKAN

WVR_TextureTarget_VULKAN: Correspond to Vulkan target image.

enum WVR_TextureFormat

Texture format.

Enumerate the specific texture format to generate texture.

Values:

WVR_TextureFormat_RGBA

WVR_TextureFormat_RGBA: Correspond to OpenGL format of the pixel data GL_RGBA

enum WVR_TextureType

Texture type.

Enumerate the specific texture type to generate texture.

Values:

WVR_TextureType_UnsignedByte

WVR_TextureType_UnsignedByte: Correspond to OpenGL data type of the pixel data GL_UNSIGNED_BYTE

typedef void *WVR_TextureQueueHandle_t

WVR_TextureQueueHandle_t: type define the name of texture queue handler instance in runtime.

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_Default};
WVR_RenderError pError = WVR_RenderInit(&param);
if (pError != WVR_RenderError_None) {
    LOGE("Render init failed - Error[%d]", pError);
}

FrameBufferObject* fbo;
uint32_t RenderWidth = 0, RenderHeight = 0;
WVR_GetRenderTargetSize(&RenderWidth, &RenderHeight);

if (gMultiview == false) {
    std::vector<FrameBufferObject*> LeftEyeFBO;
    std::vector<FrameBufferObject*> RightEyeFBO;

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

    for (int i = 0; i < WVR_GetTextureQueueLength(mLeftEyeQ); i++) {
        fbo = new FrameBufferObject((int)WVR_GetTexture(mLeftEyeQ, i).id, RenderWidth, RenderHeight);
        LeftEyeFBO.push_back(fbo);
    }
    for (int j = 0; j < WVR_GetTextureQueueLength(mRightEyeQ); j++) {
        fbo = new FrameBufferObject((int)WVR_GetTexture(mRightEyeQ, j).id, RenderWidth, RenderHeight);
        RightEyeFBO.push_back(fbo);
    }

} else {
    std::vector<FrameBufferObject*> MultiviewFBO;

    // Utilize WVR_TextureTarget_2D_ARRAY as target texture for multiview extension.
    void* MultiviewQ = WVR_ObtainTextureQueue(WVR_TextureTarget_2D_ARRAY, WVR_TextureFormat_RGBA, WVR_TextureType_UnsignedByte, RenderWidth, RenderHeight, 0);

    for (int i = 0; i < WVR_GetTextureQueueLength(MultiviewQ); i++) {
        fbo = new FrameBufferObject((int)WVR_GetTexture(MultiviewQ, i).id, RenderWidth, RenderHeight);
        MultiviewFBO.push_back(fbo);
    }
}