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.
- Parameters
- target -
Specifies the target texture. Must be WVR_TextureTarget_2D or WVR_TextureTarget_2D_ARRAY.
- 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.
- height -
Specifies the height of the texture image.
- level -
Specifies the level-of-detail number.
- target -
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
- 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_Timewarp_Asynchronous};
WVR_RenderError pError = WVR_RenderInit(¶m);
if (pError != WVR_RenderError_None) {
LOGE("Render init failed - Error[%d]", pError);
}
FrameBufferObject* fbo;
int QueueLength = 10;
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 < QueueLength; i++) {
fbo = new FrameBufferObject((int)WVR_GetTexture(mLeftEyeQ, i).id, RenderWidth, RenderHeight);
LeftEyeFBO.push_back(fbo);
fbo = new FrameBufferObject((int)WVR_GetTexture(mRightEyeQ, i).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 < QueueLength; i++) {
fbo = new FrameBufferObject((int)WVR_GetTexture(MultiviewQ, i).id, RenderWidth, RenderHeight);
MultiviewFBO.push_back(fbo);
}
}