Could anyone please provide a minimal working example for the C++ API?
In my implementation StartGestureDetection() fails with GestureFailureCamera. The prebuilt examples are working fine, so the camera configuration in SteamVR is fine.
I've tried the following (based on the documentaion):
#include "include/interface_gesture.hpp"
#include <iostream>
int main()
{
GestureOption option;
// Start detection and check result
GestureFailure result = StartGestureDetection(&option);
if (result != GestureFailureNone) {
std::cout << "Detection start failed with error: " << result << std::endl;
return 1;
}
std::cout << "Detection started" << std::endl;
const GestureResult* points = NULL;
int lastFrameIndex = -1;
// pseudo game loop
while (true) {
int frameIndex = -1;
int size = GetGestureResult(&points, &frameIndex);
if (frameIndex < 0) {
std::cout << "Gesture detection start failed with error: " << result << std::endl;
break;
} else if (frameIndex == lastFrameIndex)
continue;
lastFrameIndex = frameIndex;
// do stuffs with points
for (int i = 0; i < size; i++)
std::cout << "Hand " << i << " is " << (points[i].isLeft ? "left" : "right") << " hand" << std::endl;
}
return 0;
}
Thanks. @zzy