This site has been permanently archived. The content on this site was last updated in 2019.
Stay organized with collections
Save and categorize content based on your preferences.
gvr::SwapChain
#include <gvr.h>
Convenience C++ wrapper for gvr_swap_chain, which represents a queue of frames.
Summary
The GvrApi object must outlive any SwapChain objects created from it.
Inheritance
Inherits from:
gvr::WrapperBase< gvr_swap_chain, gvr_swap_chain_destroy >Public functions
AcquireFrame
Frame AcquireFrame()
For more information, see gvr_swap_chain_acquire_frame().
Note that if Frame acquisition fails, the returned Frame may not be valid. The caller should inspect the returned Frame's validity before using, and reschedule frame acquisition upon failure.
GetBufferCount
int32_t GetBufferCount() const
GetBufferSize
Sizei GetBufferSize(
int32_t index
) const
ResizeBuffer
void ResizeBuffer(
int32_t index,
Sizei size
)
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[null,null,["Last updated 2024-10-09 UTC."],[[["\u003cp\u003e\u003ccode\u003egvr::SwapChain\u003c/code\u003e is a C++ wrapper for \u003ccode\u003egvr_swap_chain\u003c/code\u003e providing a frame queue for VR rendering.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits from \u003ccode\u003egvr::WrapperBase\u003c/code\u003e and is managed by a \u003ccode\u003eGvrApi\u003c/code\u003e instance, which must outlive it.\u003c/p\u003e\n"],["\u003cp\u003eKey functionalities include acquiring frames (\u003ccode\u003eAcquireFrame\u003c/code\u003e), getting buffer count (\u003ccode\u003eGetBufferCount\u003c/code\u003e), retrieving buffer size (\u003ccode\u003eGetBufferSize\u003c/code\u003e), and resizing buffers (\u003ccode\u003eResizeBuffer\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eFrame acquisition may fail, requiring the caller to validate the returned \u003ccode\u003eFrame\u003c/code\u003e object before use.\u003c/p\u003e\n"],["\u003cp\u003eDetailed usage and further information can be found in the linked documentation for each corresponding function within the \u003ccode\u003egvr_swap_chain\u003c/code\u003e API.\u003c/p\u003e\n"]]],["The `gvr::SwapChain` is a C++ wrapper for managing a queue of frames. Key actions include: acquiring a frame using `AcquireFrame()`, retrieving the number of buffers with `GetBufferCount()`, obtaining the size of a specific buffer via `GetBufferSize(index)`, and resizing a buffer using `ResizeBuffer(index, size)`. A `GvrApi` object must persist throughout the lifespan of any `SwapChain` objects created from it. When using `AcquireFrame()` you must check if the frame is valid.\n"],null,["# gvr::SwapChain Class Reference\n\ngvr::SwapChain\n==============\n\n`#include \u003cgvr.h\u003e`\n\nConvenience C++ wrapper for gvr_swap_chain, which represents a queue of frames.\n\nSummary\n-------\n\nThe [GvrApi](/vr/reference/ios-ndk/class/gvr/gvr-api#classgvr_1_1_gvr_api) object must outlive any [SwapChain](/vr/reference/ios-ndk/class/gvr/swap-chain#classgvr_1_1_swap_chain) objects created from it.\n\n### Inheritance\n\nInherits from: [gvr::WrapperBase\\\u003c gvr_swap_chain, gvr_swap_chain_destroy \\\u003e](/vr/reference/ios-ndk/class/gvr/wrapper-base)\n\n| ### Public functions ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AcquireFrame](#classgvr_1_1_swap_chain_1ad109fd7b3392edcf00971abc3e5ddb67)`()` | [Frame](/vr/reference/ios-ndk/class/gvr/frame#classgvr_1_1_frame) For more information, see [gvr_swap_chain_acquire_frame()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga0d43a60eedfb0fdcf429186b3aa52636). |\n| [GetBufferCount](#classgvr_1_1_swap_chain_1a3cccc0209bb0a44f647cb6874fc73080)`() const ` | `int32_t` For more information, see [gvr_swap_chain_get_buffer_count()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga0dbc6508197953dd7375e4a138a4d0f6). |\n| [GetBufferSize](#classgvr_1_1_swap_chain_1adbb9e1fa3e2a50432c1cd05aab51f1a4)`(int32_t index) const ` | [Sizei](/vr/reference/ios-ndk/struct/gvr-sizei#structgvr__sizei) For more information, see [gvr_swap_chain_get_buffer_size()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1gafe8d1ffdb63232da23d5534179618ac6). |\n| [ResizeBuffer](#classgvr_1_1_swap_chain_1a33239d768299a8f7662d9529d973a3ab)`(int32_t index, `[Sizei](/vr/reference/ios-ndk/struct/gvr-sizei#structgvr__sizei)` size)` | `void` For more information, see [gvr_swap_chain_resize_buffer()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga711add709bbfef5db1ddf98640c972ee). |\n\nPublic functions\n----------------\n\n### AcquireFrame\n\n```text\nFrame AcquireFrame()\n``` \nFor more information, see [gvr_swap_chain_acquire_frame()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga0d43a60eedfb0fdcf429186b3aa52636).\n\nNote that if [Frame](/vr/reference/ios-ndk/class/gvr/frame#classgvr_1_1_frame) acquisition fails, the returned [Frame](/vr/reference/ios-ndk/class/gvr/frame#classgvr_1_1_frame) may not be valid. The caller should inspect the returned [Frame](/vr/reference/ios-ndk/class/gvr/frame#classgvr_1_1_frame)'s validity before using, and reschedule frame acquisition upon failure. \n\n### GetBufferCount\n\n```gdscript\nint32_t GetBufferCount() const \n``` \nFor more information, see [gvr_swap_chain_get_buffer_count()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga0dbc6508197953dd7375e4a138a4d0f6). \n\n### GetBufferSize\n\n```gdscript\nSizei GetBufferSize(\n int32_t index\n) const \n``` \nFor more information, see [gvr_swap_chain_get_buffer_size()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1gafe8d1ffdb63232da23d5534179618ac6). \n\n### ResizeBuffer\n\n```scdoc\nvoid ResizeBuffer(\n int32_t index,\n Sizei size\n)\n``` \nFor more information, see [gvr_swap_chain_resize_buffer()](/vr/reference/ios-ndk/group/swap-chain#group__swap__chain_1ga711add709bbfef5db1ddf98640c972ee)."]]