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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["\u003cp\u003e\u003ccode\u003egvr::SwapChain\u003c/code\u003e is a C++ convenience wrapper for \u003ccode\u003egvr_swap_chain\u003c/code\u003e and represents a queue of frames used in VR rendering.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to acquire, resize, and retrieve information about the buffers used for rendering frames.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003egvr::GvrApi\u003c/code\u003e object must be active and outlive any \u003ccode\u003egvr::SwapChain\u003c/code\u003e objects it creates.\u003c/p\u003e\n"],["\u003cp\u003eUpon acquiring a frame, always inspect its validity using \u003ccode\u003eFrame.IsValid()\u003c/code\u003e before using it to avoid potential rendering issues.\u003c/p\u003e\n"],["\u003cp\u003eFor more detailed descriptions of each function, refer to the linked documentation of the corresponding \u003ccode\u003egvr_swap_chain\u003c/code\u003e functions.\u003c/p\u003e\n"]]],["The `gvr::SwapChain` is a C++ wrapper for managing a queue of frames. Key actions include `AcquireFrame`, which retrieves a frame, and the caller should inspect the frame's validity before use. `GetBufferCount` retrieves the number of buffers, `GetBufferSize` fetches the size of a specified buffer. Lastly `ResizeBuffer` allows modification of a specified buffer's dimensions. The `GvrApi` object must persist longer than any `SwapChain` objects.\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/android-ndk/class/gvr/gvr-api#classgvr_1_1_gvr_api) object must outlive any [SwapChain](/vr/reference/android-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/android-ndk/class/gvr/wrapper-base)\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [AcquireFrame](#classgvr_1_1_swap_chain_1ad109fd7b3392edcf00971abc3e5ddb67)`()` | [Frame](/vr/reference/android-ndk/class/gvr/frame#classgvr_1_1_frame) For more information, see [gvr_swap_chain_acquire_frame()](/vr/reference/android-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/android-ndk/group/swap-chain#group__swap__chain_1ga0dbc6508197953dd7375e4a138a4d0f6). |\n| [GetBufferSize](#classgvr_1_1_swap_chain_1adbb9e1fa3e2a50432c1cd05aab51f1a4)`(int32_t index) const ` | [Sizei](/vr/reference/android-ndk/struct/gvr-sizei#structgvr__sizei) For more information, see [gvr_swap_chain_get_buffer_size()](/vr/reference/android-ndk/group/swap-chain#group__swap__chain_1gafe8d1ffdb63232da23d5534179618ac6). |\n| [ResizeBuffer](#classgvr_1_1_swap_chain_1a33239d768299a8f7662d9529d973a3ab)`(int32_t index, `[Sizei](/vr/reference/android-ndk/struct/gvr-sizei#structgvr__sizei)` size)` | `void` For more information, see [gvr_swap_chain_resize_buffer()](/vr/reference/android-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/android-ndk/group/swap-chain#group__swap__chain_1ga0d43a60eedfb0fdcf429186b3aa52636).\n\nNote that if [Frame](/vr/reference/android-ndk/class/gvr/frame#classgvr_1_1_frame) acquisition fails, the returned [Frame](/vr/reference/android-ndk/class/gvr/frame#classgvr_1_1_frame) may not be valid. The caller should inspect the returned [Frame](/vr/reference/android-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/android-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/android-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/android-ndk/group/swap-chain#group__swap__chain_1ga711add709bbfef5db1ddf98640c972ee)."]]