-
-
Save rfht/3e747637c5623fdf273d3a306e0980df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//gcc osvrexample.c -losvrClientKit | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <osvr/ClientKit/ContextC.h> | |
#include <osvr/ClientKit/InterfaceC.h> | |
#include <osvr/ClientKit/InterfaceStateC.h> | |
int main() { | |
OSVR_ClientContext osvrctx = osvrClientInit("com.osvr.osvrexample", 0); | |
OSVR_ClientInterface head; | |
osvrClientGetInterface(osvrctx, "/me/head", &head); | |
while (1) { | |
osvrClientUpdate(osvrctx); | |
OSVR_TimeValue timestamp; | |
OSVR_PoseState state; | |
OSVR_ReturnCode ret = osvrGetPoseState(head, ×tamp, &state); | |
if (OSVR_RETURN_SUCCESS != ret) { | |
//No pose state; | |
continue; | |
} | |
printf("Head Roation: %f %f %f %f; Head Position: %f %f %f\n", osvrQuatGetX(&state.rotation), osvrQuatGetY(&state.rotation), osvrQuatGetZ(&state.rotation), osvrQuatGetW(&state.rotation), osvrVec3GetX(&state.translation), osvrVec3GetY(&state.translation), osvrVec3GetZ(&state.translation)); | |
usleep(100 * 1000); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment