# Naitve PC XR SDK
# Preliminary
# Device connection
Please make sure that Pimax Client software can detect Pimax headset that may experience Pimax Client's contents after connecting Pimax headset to PC and installing Pimax PC Client.
# SDK installation
Download PC Windows SDK from here and install it. We will take installation path C:\ Program Files\Pimax\Sdk\ for example. Please replace it with youractual Path if you install the SDK at other directory.
# Related basic knowledge
Developers should have basic C, C++ programming skills, familiar with DirectX or API ofOpenGL.
WARNING
The current SDK only supports the development of DirectX11 and OpenGL.DirectX12 and Vulkan will be supported in the future
# Compiler Options setup
Add C:\Program Files\Pimax\Sdk\Include to the path that involves header file in developerbuild project, so long as related header file is involved in codes without linking extra Lib.
# Related Terms
- VR: Virtual Reality
- PVR: Pimax VR
- HMD: Head Mounted Display
- App: Application
- PVR Runtime: The process that is used for managing VR devices is in charge of requests from App.
# Main function introduction
# Header file usage
So long as PVR_API.h is involved in related codes. PVR_API_D3D.h also needs to be involved if the related rendering is based on DirectX. PVR_API_GL.h is involved in related codes if related rendering base on OpenGL.
# Create a runtime environment
Every App needs to use pvr_initialise to initialize the unique runtime environment before using the function of SDK.
# Create Session
Every App needs a Session that is created by pvr_createSession to communicate with PVR Runtime. Please call pvr_createSession to destroy this Session beforequitting App. An App may create many Session.
# Create TextureSwapChain
It’s is similar to DXGI’S SwapChainBuffer and created by pvr_createTextureSwapChainDX or pvr_createTextureSwapChainGL. Every SwapChainBuffer involves many texture buffer. Through pvr_getTextureSwapChainCurrentIndex to obtain an available buffer’s idex in every frame of App, and then through pvr_getTextureSwapChainBufferDX or pvr_getTextureSwapChainBufferGL to obtain corresponding buffer in which App will render, finally through pvr_commitTextureSwapChain to submit.
# Obtain positional information
It needs to obtain correct information of eye’s pose (position and direction) to render left and right eyes’ images correctly. Obtain head’s pose (controller also) through pvr_getTrackingState at a point in time. Usually we use pvr_getPredictedDisplayTime to obtain time point and through pvr_getEyeRenderInfo to obtain head and eye’s related poses, then through pvr_calcEyePoses to figure out eye’s pose that will be used as View Matrix in App.
# Render stereo images
The current buffer of TextureSwapChain is used as render target in App, obtain View Matrix from last step, and utilize pvrMatrix4f_Projection to obtain Projection Matrix, render the App content into TextureSwapChain.
# Submit stereo images to device
Submit rendered TextureSwapChain of App to PVR Runtime through pvr_submitFrame, finally display to Pimax headset.
# Handle controller input
Obtain current keystroke info of controller through pvr_getInputState in the loop of App.
# Mulit-graphics handle
Obtain appointed Adapter Id through pvr_getEyeDisplayInfo in App, and then utilize appointed Adapter to create D3D Device.
# Samples
SimpleVRDemoDX11: Base on DirectXTK’s VR demo.