Last active
March 28, 2018 04:21
-
-
Save ChristophHaag/3e1c058a9bfbb350a4c3f9d545b0ca74 to your computer and use it in GitHub Desktop.
This file contains 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