WVR_RequestScreenshot

WVR_EXPORT bool WVR_RequestScreenshot(uint32_t width, uint32_t height, WVR_ScreenshotMode mode = WVR_ScreenshotMode_Default, const char * filename = NULL)

Request a screenshot of requested mode.

This function must be called after WVR_RenderInit.

Version
API Level 1
Parameters
  • width: Specifies the width of the texture image.
  • height: Specifies the height of the texture image.
  • mode: Specifies requested screenshot mode. The values should be one of WVR_ScreenshotMode.
  • filename: Specifies preferred saving filename. (optional)
Return Value
  • true: Succeed to request screenshot.
  • false: Fail to request screenshot.

Struct and enumeration

enum WVR_ScreenshotMode

Screenshot mode.

Enumerate screenshot mode to select stereo scene or single eye image.

Values:

WVR_ScreenshotMode_Default

WVR_ScreenshotMode_Default: Screenshot image is stereo. Just as what is shown on screen

WVR_ScreenshotMode_Raw

WVR_ScreenshotMode_Raw: Screenshot image has only single eye, and without distortion correction

WVR_ScreenshotMode_Distorted

WVR_ScreenshotMode_Distorted: Screenshot image has only single eye, and with distortion correction

How to use

Here is an example for the function:

#include <wvr/wvr_projection.h>

// Take a screen shot of a stereo image.
void StereoScreenShotExample() {
    uint32_t width, uint32_t height;
    //Function to get the suggested size of render target
    WVR_GetRenderTargetSize(&width, &height);
    //Function to get the screen shot.
    bool result = WVR_RequestScreenshot(width, height, WVR_ScreenshotMode_Default);
}

// Take a screen shot of a single image.
void SingleScreenShotExample() {
    uint32_t width, uint32_t height;
    //Function to get the suggested size of render target
    WVR_GetRenderTargetSize(&width, &height);
    //Function to get the screen shot.
    bool result = WVR_RequestScreenshot(width, height, WVR_ScreenshotMode_Raw);
}

You need require WRITE_EXTERNAL_STORAGE permission in AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Screenshot will be saved into the system default screenshot folder. For example, in /sdcard/Pictures/Screenshots for Android.