Skip to content

Instantly share code, notes, and snippets.

@demonixis
Created December 21, 2016 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save demonixis/49419221bfc412d2802da95f9f589bdf to your computer and use it in GitHub Desktop.
Save demonixis/49419221bfc412d2802da95f9f589bdf to your computer and use it in GitHub Desktop.
A simple C++ program that reads the rotation of the Pimax 4k HMD
#include <PVR_API.h>
#include <iostream>
int main(int argc, char** argv)
{
pvrResult result = pvr_initialise();
if (result == pvr_success)
{
std::cout << "PVR SDK Initialized!" << std::endl;
PvrHmdHandle hmd;
result = pvr_createHmd(&hmd);
if (result == pvr_success)
{
std::cout << "PVR Device Created!" << std::endl;
pvrPoseStatef pose;
result = pvr_getHmdPoseState(hmd, &pose);
if (result == pvr_success)
{
std::cout << "Rotation W: " << pose.ThePose.Orientation.w << std::endl;
std::cout << "Rotation X: " << pose.ThePose.Orientation.x << std::endl;
std::cout << "Rotation Y: " << pose.ThePose.Orientation.y << std::endl;
std::cout << "Rotation Z: " << pose.ThePose.Orientation.z << std::endl;
}
}
else
std::cout << "PVR Device Not Created" << std::endl;
}
else
std::cout << "PVR SDK Not Initialized.";
return 0;
}
@flexodood
Copy link

hi. this looks perfect. sadly i have no idea how to use it. does it work if i disable the sensor in piplay? can i get the data into freetrack/opentrack with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment